private void processLoginModules(OperationContext context, ModelNode node, BaseAuthenticationInfo authInfo, LoginModuleContainer container) throws OperationFailedException { for (Property moduleProperty : node.asPropertyList()) { ModelNode module = moduleProperty.getValue(); String codeName = extractCode(context, module, ModulesMap.AUTHENTICATION_MAP); String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString(); LoginModuleControlFlag controlFlag = getControlFlag(flag); Map<String, Object> options = extractOptions(context, module); AppConfigurationEntry entry = new AppConfigurationEntry(codeName, controlFlag, options); container.addAppConfigurationEntry(entry); ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module); if (moduleName.isDefined() && !moduleName.asString().isEmpty()) { authInfo.addJBossModuleName(moduleName.asString()); } else { authInfo.addJBossModuleName(DEFAULT_MODULE); } } }
/** * <p> * Creates and returns a copy of the specified list of {@code AppConfigurationEntry} objects, adding the security * domain option when necessary. Execution of this method requires a {@code getLoginConfiguration} permission. * * </p> * * @param entries a {@code List} containing the {@code AppConfigurationEntry} objects to be copied. * @return an {@code AppConfigurationEntry} array containing the copied entries. */ protected AppConfigurationEntry[] copyAppConfigurationEntry(List<Object> entries) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(GET_CONFIG_ENTRY_PERM); AppConfigurationEntry[] copy = new AppConfigurationEntry[entries.size()]; for (int i = 0; i < copy.length; i++) { AppConfigurationEntry entry = (AppConfigurationEntry) entries.get(i); HashMap<String, Object> options = new HashMap<String, Object>(entry.getOptions()); if (!disableSecurityDomainInOptions()) { options.put(SecurityConstants.SECURITY_DOMAIN_OPTION, this.getName()); } copy[i] = new AppConfigurationEntry(entry.getLoginModuleName(), entry.getControlFlag(), options); } return copy; }
public AppConfigurationEntry[] run() { return theAuthInfo.copyAppConfigurationEntry(); } };
public BaseAuthenticationInfo getAuthenticationInfo() { BaseAuthenticationInfo bai = null; ApplicationPolicy ap = this.getBaseApplicationPolicy(); if (ap != null) bai = ap.getAuthenticationInfo(); if (bai != null && authenticationInfo == null) return bai; else if (bai != null) return (BaseAuthenticationInfo) authenticationInfo.merge(bai); else return authenticationInfo; }
@Override protected BaseSecurityInfo<Object> create(String name) { return new BaseAuthenticationInfo(name); }
private void processLoginModules(OperationContext context, ModelNode node, BaseAuthenticationInfo authInfo, LoginModuleContainer container) throws OperationFailedException { for (Property moduleProperty : node.asPropertyList()) { ModelNode module = moduleProperty.getValue(); String codeName = extractCode(context, module, ModulesMap.AUTHENTICATION_MAP); String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString(); LoginModuleControlFlag controlFlag = getControlFlag(flag); Map<String, Object> options = extractOptions(context, module); AppConfigurationEntry entry = new AppConfigurationEntry(codeName, controlFlag, options); container.addAppConfigurationEntry(entry); ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module); if (moduleName.isDefined() && moduleName.asString().length() > 0) { authInfo.setJBossModuleName(moduleName.asString()); } } }
public Object newChild(BaseAuthenticationInfo info, UnmarshallingContext navigator, String namespaceUri, String localName, Attributes attrs) { Object child = null; if (trace) log.trace("newChild.AuthenticationInfo, localName: " + localName); if ("authentication".equals(localName)) { child = new AuthenticationInfo(info.getName()); if (trace) log.trace("newChild.PolicyConfig, AuthenticationInfo: " + info.getName()); } else if ("authentication-jaspi".equals(localName)) { child = new JASPIAuthenticationInfo(info.getName()); if (trace) log.trace("newChild.PolicyConfig, AuthenticationInfo: " + info.getName()); } return child; }
@SuppressWarnings("unchecked") public Object instantiate() { if(isJASPIAuthentication == false) { info = new AuthenticationInfo(authName); } else { info = new JASPIAuthenticationInfo(authName); } info.add(moduleEntries); return info; }
List<String> jbossModuleNames = authInfo.getJBossModuleNames(); if(!jbossModuleNames.isEmpty())
/** * <p> * Creates and returns a copy of the specified list of {@code AppConfigurationEntry} objects, adding the security * domain option when necessary. Execution of this method requires a {@code getLoginConfiguration} permission. * * </p> * * @param entries a {@code List} containing the {@code AppConfigurationEntry} objects to be copied. * @return an {@code AppConfigurationEntry} array containing the copied entries. */ protected AppConfigurationEntry[] copyAppConfigurationEntry(List<Object> entries) { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPermission(GET_CONFIG_ENTRY_PERM); AppConfigurationEntry[] copy = new AppConfigurationEntry[entries.size()]; for (int i = 0; i < copy.length; i++) { AppConfigurationEntry entry = (AppConfigurationEntry) entries.get(i); HashMap<String, Object> options = new HashMap<String, Object>(entry.getOptions()); if (!disableSecurityDomainInOptions()) { options.put(SecurityConstants.SECURITY_DOMAIN_OPTION, this.getName()); } copy[i] = new AppConfigurationEntry(entry.getLoginModuleName(), entry.getControlFlag(), options); } return copy; }
/** * <p> * Creates and returns a copy of the application authentication configuration. By default this returns the array * created by the {@code copyAppConfigurationEntry(List)} method using the {@code moduleEntries} as a parameter. * </p> * * @return an {@code AppConfigurationEntry} array containing the copied entries. */ public AppConfigurationEntry[] copyAppConfigurationEntry() { return this.copyAppConfigurationEntry(super.moduleEntries); }
public BaseAuthenticationInfo getAuthenticationInfo() { BaseAuthenticationInfo bai = null; ApplicationPolicy ap = this.getBaseApplicationPolicy(); if (ap != null) bai = ap.getAuthenticationInfo(); if (bai != null && authenticationInfo == null) return bai; else if (bai != null) return (BaseAuthenticationInfo) authenticationInfo.merge(bai); else return authenticationInfo; }
@Override protected BaseSecurityInfo<Object> create(String name) { return new BaseAuthenticationInfo(name); }
private void processLoginModules(OperationContext context, ModelNode node, BaseAuthenticationInfo authInfo, LoginModuleContainer container) throws OperationFailedException { for (Property moduleProperty : node.asPropertyList()) { ModelNode module = moduleProperty.getValue(); String codeName = extractCode(context, module, ModulesMap.AUTHENTICATION_MAP); String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString(); LoginModuleControlFlag controlFlag = getControlFlag(flag); Map<String, Object> options = extractOptions(context, module); AppConfigurationEntry entry = new AppConfigurationEntry(codeName, controlFlag, options); container.addAppConfigurationEntry(entry); ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module); if (moduleName.isDefined() && moduleName.asString().length() > 0) { authInfo.setJBossModuleName(moduleName.asString()); } } }
public AppConfigurationEntry[] run() { return theAuthInfo.copyAppConfigurationEntry(); } };
/** * <p> * Overriden to include the stacks of login modules in the merged object. * </p> */ @Override public BaseSecurityInfo<Object> merge(BaseSecurityInfo<Object> bi) { if (bi instanceof JASPIAuthenticationInfo == false) throw new IllegalArgumentException("Base policy does not contain a JASPI authentication configuration"); // merge the auth modules JASPIAuthenticationInfo merged = (JASPIAuthenticationInfo) super.merge(bi); // merge the stacks of login modules JASPIAuthenticationInfo parent = (JASPIAuthenticationInfo) bi; for (LoginModuleStackHolder holder : parent.getLoginModuleStackHolder()) merged.add(holder); for (LoginModuleStackHolder holder : this.getLoginModuleStackHolder()) merged.add(holder); return merged; }
private void processLoginModules(OperationContext context, ModelNode node, BaseAuthenticationInfo authInfo, LoginModuleContainer container) throws OperationFailedException { for (Property moduleProperty : node.asPropertyList()) { ModelNode module = moduleProperty.getValue(); String codeName = extractCode(context, module, ModulesMap.AUTHENTICATION_MAP); String flag = LoginModuleResourceDefinition.FLAG.resolveModelAttribute(context, module).asString(); LoginModuleControlFlag controlFlag = getControlFlag(flag); Map<String, Object> options = extractOptions(context, module); AppConfigurationEntry entry = new AppConfigurationEntry(codeName, controlFlag, options); container.addAppConfigurationEntry(entry); ModelNode moduleName = LoginModuleResourceDefinition.MODULE.resolveModelAttribute(context, module); if (moduleName.isDefined() && !moduleName.asString().isEmpty()) { authInfo.addJBossModuleName(moduleName.asString()); } else { authInfo.addJBossModuleName(DEFAULT_MODULE); } } }
/** * <p> * Creates and returns a copy of the application authentication configuration. By default this returns the array * created by the {@code copyAppConfigurationEntry(List)} method using the {@code moduleEntries} as a parameter. * </p> * * @return an {@code AppConfigurationEntry} array containing the copied entries. */ public AppConfigurationEntry[] copyAppConfigurationEntry() { return this.copyAppConfigurationEntry(super.moduleEntries); }
/** * <p> * Overriden to include the stacks of login modules in the merged object. * </p> */ @Override public BaseSecurityInfo<Object> merge(BaseSecurityInfo<Object> bi) { if (bi instanceof JASPIAuthenticationInfo == false) throw PicketBoxMessages.MESSAGES.invalidType(JASPIAuthenticationInfo.class.getName()); // merge the auth modules JASPIAuthenticationInfo merged = (JASPIAuthenticationInfo) super.merge(bi); // merge the stacks of login modules JASPIAuthenticationInfo parent = (JASPIAuthenticationInfo) bi; for (LoginModuleStackHolder holder : parent.getLoginModuleStackHolder()) merged.add(holder); for (LoginModuleStackHolder holder : this.getLoginModuleStackHolder()) merged.add(holder); return merged; }
public AppConfigurationEntry[] run() { return theAuthInfo.copyAppConfigurationEntry(); } };