private void invokeAbort() throws IdentityTrustException { int length = modules.size(); for(int i = 0; i < length; i++) { IdentityTrustModule module = (IdentityTrustModule)modules.get(i); boolean bool = module.abort(); if(!bool) throw new IdentityTrustException("abort on modules failed"); } } }
private void invokeCommit() throws IdentityTrustException { int length = modules.size(); for(int i = 0; i < length; i++) { IdentityTrustModule module = (IdentityTrustModule)modules.get(i); boolean bool = module.commit(); if(!bool) throw new IdentityTrustException("commit on modules failed"); } }
/** * Whether the current caller can be trusted? * @return true - trust the caller, false - otherwise * @throws IdentityTrustException */ public boolean isTrusted() throws IdentityTrustException { TrustDecision td = TrustDecision.NotApplicable; IdentityTrustManager itm = securityContext.getIdentityTrustManager(); if(itm != null) { td = itm.isTrusted(securityContext); if(td == TrustDecision.Deny) throw new IdentityTrustException(PicketBoxMessages.MESSAGES.deniedByIdentityTrustMessage()); } return td == TrustDecision.Permit; }
initializeModules(); throw new IdentityTrustException(e); invokeAbort(); throw ((IdentityTrustException)exc);
private void initializeModules() throws Exception { //Clear the modules modules.clear(); //Get the Configuration ApplicationPolicy aPolicy = SecurityConfiguration.getApplicationPolicy( securityDomain); if(aPolicy == null) throw new IllegalStateException("ApplicationPolicy not found for "+ securityDomain); IdentityTrustInfo iti = aPolicy.getIdentityTrustInfo(); if(iti == null) return; IdentityTrustModuleEntry[] itmearr = iti.getIdentityTrustModuleEntry(); for(IdentityTrustModuleEntry itme: itmearr) { ControlFlag cf = itme.getControlFlag(); if(cf == null) cf = ControlFlag.REQUIRED; this.controlFlags.add(cf); modules.add(instantiateModule(itme.getName(), itme.getOptions())); } }
try decision = module.isTrusted(); moduleException = new IdentityTrustException(ae); moduleException = new IdentityTrustException("Identity Trust Validation failed"); else throw moduleException;
/** * @see IdentityTrustManager#isTrusted() */ public TrustDecision isTrusted(SecurityContext securityContext) { if(securityContext == null) throw new IllegalArgumentException("Security Context is null"); if(this.identityTrustContext == null) this.identityTrustContext = new JBossIdentityTrustContext(securityDomain, securityContext); TrustDecision td = TrustDecision.NotApplicable; if(this.identityTrustContext == null) throw new IllegalStateException("IdentityTrustContext is null"); try { td = this.identityTrustContext.isTrusted(); } catch (IdentityTrustException e) { log.trace("Trust Exception:",e); } return td; }
@SuppressWarnings("unchecked") private IdentityTrustModule instantiateModule(String name, Map map) throws Exception { IdentityTrustModule im = null; ClassLoader tcl = SecurityActions.getContextClassLoader(); try { Class clazz = tcl.loadClass(name); im = (IdentityTrustModule)clazz.newInstance(); } catch ( Exception e) { log.debug("Error instantiating IdentityTrustModule:",e); } if(im == null) throw new IllegalStateException("IdentityTrustModule has not " + "been instantiated"); im.initialize(this.securityContext, this.callbackHandler, this.sharedState,map); return im; }
@SuppressWarnings({"unchecked", "rawtypes"}) private IdentityTrustModule instantiateModule(ClassLoader cl, String name, Map map) throws Exception { IdentityTrustModule im = null; try { Class clazz = SecurityActions.loadClass(cl, name); im = (IdentityTrustModule)clazz.newInstance(); } catch ( Exception e) { PicketBoxLogger.LOGGER.debugIgnoredException(e); } if(im == null) throw new LoginException(PicketBoxMessages.MESSAGES.failedToInstantiateClassMessage(IdentityTrustModule.class)); im.initialize(this.securityContext, this.callbackHandler, this.sharedState,map); return im; }
public Class<?> run() throws PrivilegedActionException { try { return getContextClassLoader().loadClass(name); } catch ( Exception e) { throw new PrivilegedActionException(e); } } });
/** * Whether the current caller can be trusted? * @return true - trust the caller, false - otherwise * @throws IdentityTrustException */ public boolean isTrusted() throws IdentityTrustException { TrustDecision td = TrustDecision.NotApplicable; IdentityTrustManager itm = securityContext.getIdentityTrustManager(); if(itm != null) { td = itm.isTrusted(securityContext); if(td == TrustDecision.Deny) throw new IdentityTrustException(PicketBoxMessages.MESSAGES.deniedByIdentityTrustMessage()); } return td == TrustDecision.Permit; }
initializeModules(); throw new IdentityTrustException(e); invokeAbort(); throw ((IdentityTrustException)exc);
for(IdentityTrustModuleEntry itme: itmearr) ControlFlag cf = itme.getControlFlag(); if(cf == null) cf = ControlFlag.REQUIRED; IdentityTrustModule module = instantiateModule(moduleCL, itme.getName(), itme.getOptions()); modules.add(module);
private void invokeAbort() throws IdentityTrustException { int length = modules.size(); for(int i = 0; i < length; i++) { IdentityTrustModule module = modules.get(i); boolean bool = module.abort(); if(!bool) throw new IdentityTrustException(PicketBoxMessages.MESSAGES.moduleAbortFailedMessage()); } } }
private void invokeCommit() throws IdentityTrustException { int length = modules.size(); for(int i = 0; i < length; i++) { IdentityTrustModule module = modules.get(i); boolean bool = module.commit(); if(!bool) throw new IdentityTrustException(PicketBoxMessages.MESSAGES.moduleCommitFailedMessage()); } }
try decision = module.isTrusted(); moduleException = new IdentityTrustException(ae); moduleException = new IdentityTrustException(PicketBoxMessages.MESSAGES.identityTrustValidationFailedMessage()); else throw moduleException;
/** * @see IdentityTrustManager#isTrusted(org.jboss.security.SecurityContext) */ public TrustDecision isTrusted(SecurityContext securityContext) { if(securityContext == null) throw PicketBoxMessages.MESSAGES.invalidNullArgument("securityContext"); if(this.identityTrustContext == null) this.identityTrustContext = new JBossIdentityTrustContext(securityDomain, securityContext); TrustDecision td = TrustDecision.NotApplicable; if(this.identityTrustContext == null) throw PicketBoxMessages.MESSAGES.invalidNullProperty("identityTrustContext"); try { td = this.identityTrustContext.isTrusted(); } catch (IdentityTrustException e) { PicketBoxLogger.LOGGER.debugIgnoredException(e); } return td; }
public Class<?> run() throws PrivilegedActionException { try { return getContextClassLoader().loadClass(name); } catch ( Exception e) { throw new PrivilegedActionException(e); } } });
/** * Whether the current caller can be trusted? * @return true - trust the caller, false - otherwise * @throws IdentityTrustException */ public boolean isTrusted() throws IdentityTrustException { TrustDecision td = TrustDecision.NotApplicable; IdentityTrustManager itm = securityContext.getIdentityTrustManager(); if(itm != null) { td = itm.isTrusted(securityContext); if(td == TrustDecision.Deny) throw new IdentityTrustException(PicketBoxMessages.MESSAGES.deniedByIdentityTrustMessage()); } return td == TrustDecision.Permit; }