/** * Invoke modules according to configuration */ Object[] invoke(final String methodName, final Object[] args) throws AuthException { // invoke modules in a doPrivileged final Object rValues[] = new Object[entries.length]; try { java.security.AccessController.doPrivileged (new java.security.PrivilegedExceptionAction() { public Object run() throws AuthException { invokePriv(methodName, args, rValues); return null; } }); } catch (java.security.PrivilegedActionException pae) { if (pae.getException() instanceof AuthException) { throw (AuthException)pae.getException(); } else { AuthException ae = new AuthException(); ae.initCause(pae.getException()); throw ae; } } return rValues; }
public boolean managesSessions(Map sharedState) throws AuthException { // invoke modules Object[] args = { sharedState }; Object[] rValues = null; try { rValues = context.invoke(AuthContext.MANAGES_SESSIONS, args); } catch (AuthException ae) { // this new method may not be implemeneted // by old modules if (!(ae.getCause() instanceof NoSuchMethodException)) { throw ae; } } boolean rvalue = false; for (int i=0; rValues != null && i<rValues.length; i++) { if (rValues[i] != null) { boolean thisValue = ((Boolean) rValues[i]).booleanValue(); rvalue = rvalue | thisValue; } } return rvalue; } }
public void refresh() throws AuthException { synchronized (this) { ConfigParser nextParser; int next = this.epoch + 1; try { nextParser = ConfigFile.loadParser(parserClassName); } catch (IOException ioe) { throw new AuthException(ioe.toString()); } this.epoch = (next == 0 ? 1 : next); parser = nextParser; } }
public void refresh() throws AuthException { synchronized (this) { ConfigParser nextParser; int next = this.epoch + 1; try { nextParser = ConfigFile.loadParser(parserClassName); } catch (IOException ioe) { throw new AuthException(ioe.toString()); } this.epoch = (next == 0 ? 1 : next); parser = nextParser; } }
/** * Invoke modules according to configuration */ Object[] invoke(final String methodName, final Object[] args) throws AuthException { // invoke modules in a doPrivileged final Object rValues[] = new Object[entries.length]; try { java.security.AccessController.doPrivileged (new java.security.PrivilegedExceptionAction() { public Object run() throws AuthException { invokePriv(methodName, args, rValues); return null; } }); } catch (java.security.PrivilegedActionException pae) { if (pae.getException() instanceof AuthException) { throw (AuthException)pae.getException(); } else { AuthException ae = new AuthException(); ae.initCause(pae.getException()); throw ae; } } return rValues; }
MessageConstants.REQUESTER_SERIAL, sharedState.get(REQUESTER_SERIAL)); } private void populateSharedStateFromContext(Map sharedState, ProcessingContextImpl context) { sharedState.put( REQUESTER_SUBJECT, context.getExtraneousProperty(MessageConstants.AUTH_SUBJECT)); sharedState.put( REQUESTER_KEYID, context.getExtraneousProperty(MessageConstants.REQUESTER_KEYID)); sharedState.put( REQUESTER_ISSUERNAME, context.getExtraneousProperty(MessageConstants.REQUESTER_ISSUERNAME)); sharedState.put( REQUESTER_SERIAL, context.getExtraneousProperty(MessageConstants.REQUESTER_SERIAL)); } }
public boolean managesSessions(Map sharedState) throws AuthException { // invoke modules Object[] args = { sharedState }; Object[] rValues = null; try { rValues = context.invoke(AuthContext.MANAGES_SESSIONS, args); } catch (AuthException ae) { // this new method may not be implemeneted // by old modules if (!(ae.getCause() instanceof NoSuchMethodException)) { throw ae; } } boolean rvalue = false; for (int i=0; rValues != null && i<rValues.length; i++) { if (rValues[i] != null) { boolean thisValue = ((Boolean) rValues[i]).booleanValue(); rvalue = rvalue | thisValue; } } return rvalue; } }
/** * get the default callback handler */ private static CallbackHandler loadDefaultCallbackHandler() throws AuthException { // get the default handler class try { final ClassLoader finalLoader = AuthConfig.getClassLoader(); return (CallbackHandler) java.security.AccessController.doPrivileged (new java.security.PrivilegedExceptionAction() { public Object run() throws Exception { String className = DEFAULT_HANDLER_CLASS; Class c = Class.forName(className, true, finalLoader); return c.newInstance(); } }); } catch (java.security.PrivilegedActionException pae) { AuthException aex = new AuthException(pae.getException().toString()); aex.initCause(pae.getException()); throw aex; } }
throw new AuthException(xwsse.getMessage()); } } public void disposeSubject (Subject subject, Map sharedState) throws AuthException { if (subject == null) { // log throw new AuthException("Error disposing Subject: null value for Subject"); } if (!subject.isReadOnly()) { // log //subject = new Subject(); return; } Set principals = subject.getPrincipals(); Set privateCredentials = subject.getPrivateCredentials(); Set publicCredentials = subject.getPublicCredentials(); try { principals.clear(); } catch (UnsupportedOperationException uoe) { // log } Iterator pi = privateCredentials.iterator(); while (pi.hasNext()) {
/** * get the default callback handler */ private static CallbackHandler loadDefaultCallbackHandler() throws AuthException { // get the default handler class try { final ClassLoader finalLoader = AuthConfig.getClassLoader(); return (CallbackHandler) java.security.AccessController.doPrivileged (new java.security.PrivilegedExceptionAction() { public Object run() throws Exception { String className = DEFAULT_HANDLER_CLASS; Class c = Class.forName(className, true, finalLoader); return c.newInstance(); } }); } catch (java.security.PrivilegedActionException pae) { AuthException aex = new AuthException(pae.getException().toString()); aex.initCause(pae.getException()); throw aex; } }
private void populateContextFromSharedState(ProcessingContextImpl context, Map sharedState) { context.setExtraneousProperty( MessageConstants.AUTH_SUBJECT, sharedState.get(REQUESTER_SUBJECT));
/** * Return a new instance of the module contained in this entry. * * <p> The default implementation of this method attempts * to invoke the default no-args constructor of the module class. * This method may be overridden if a different constructor * should be invoked. * * @return a new instance of the module contained in this entry. * * @exception AuthException if the instantiation failed. */ Object newInstance() throws AuthException { try { final ClassLoader finalLoader= AuthConfig.getClassLoader(); String clazz = getLoginModuleName(); Class c = Class.forName(clazz, true, finalLoader); java.lang.reflect.Constructor constructor = c.getConstructor(PARAMS); return constructor.newInstance(ARGS); } catch (Exception e) { AuthException ae = new AuthException(); ae.initCause(e); throw ae; } } }
/** * Return a new instance of the module contained in this entry. * * <p> The default implementation of this method attempts * to invoke the default no-args constructor of the module class. * This method may be overridden if a different constructor * should be invoked. * * @return a new instance of the module contained in this entry. * * @exception AuthException if the instantiation failed. */ Object newInstance() throws AuthException { try { final ClassLoader finalLoader= AuthConfig.getClassLoader(); String clazz = getLoginModuleName(); Class c = Class.forName(clazz, true, finalLoader); java.lang.reflect.Constructor constructor = c.getConstructor(PARAMS); return constructor.newInstance(ARGS); } catch (Exception e) { AuthException ae = new AuthException(); ae.initCause(e); throw ae; } } }
throw (AuthException)e; AuthException ae = new AuthException(); ae.initCause(e); throw ae;
throw (AuthException)e; AuthException ae = new AuthException(); ae.initCause(e); throw ae;
" does not implement " + methodName); AuthException ae = new AuthException(); ae.initCause(nsme); throw ae; AuthException ae = new AuthException(); ae.initCause(iae); throw ae; } catch (InvocationTargetException ite) { ae = (AuthException)ite.getCause(); } else { ae = new AuthException(); ae.initCause(ite.getCause());
" does not implement " + methodName); AuthException ae = new AuthException(); ae.initCause(nsme); throw ae; AuthException ae = new AuthException(); ae.initCause(iae); throw ae; } catch (InvocationTargetException ite) { ae = (AuthException)ite.getCause(); } else { ae = new AuthException(); ae.initCause(ite.getCause());