All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.security.microcontainer.beans.metadata.JASPIAuthenticationMetaData Maven / Gradle / Ivy

/*
 * JBoss, Home of Professional Open Source.
 * Copyright 2008, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors. 
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.security.microcontainer.beans.metadata;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

import org.jboss.beans.metadata.spi.BeanMetaData;
import org.jboss.beans.metadata.spi.ValueMetaData;
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;

/**
 * 

* This class represents the {@code } configuration in an application policy and contains the * jaspi authentication metadata information extracted by the XB parser. *

*

* The following policy excerpt shows an example of {@code } configuration: * *

 *  <application-policy xmlns="urn:jboss:security-beans:1.0" name="TestPolicy1">
 *     <authentication-jaspi>
 *        <login-module-stack name="ModuleStack1">
 *           <login-module code="org.jboss.security.auth.StackModule1" flag="required">
 *              <module-option name="stackOption1">stack1.value1</module-option>
 *           </login-module>
 *           <login-module code="org.jboss.security.auth.StackModule2" flag="option"/>
 *        </login-module-stack>
 *        <login-module-stack name="ModuleStack2">
 *           <login-module code="org.jboss.security.auth.StackModule1" flag="required">
 *              <module-option name="stackOption1">stack2.value1</module-option>
 *              <module-option name="stackOption2">stack2.value2</module-option>
 *           </login-module>
 *        </login-module-stack>
 *        <auth-module code="org.jboss.security.auth.AuthModule" login-module-stack-ref="ModuleStack1">
 *           <module-option name="authOption1">auth.value1</module-option>
 *           <module-option name="authOption2">auth.value2</module-option>
 *        </auth-module>
 *     </authentication-jaspi>
 *  ...
 *  </application-policy>
 * 
* * The metadata that results from the XB parsing is used by the microcontainer to create an instance of * {@code JASPIAuthenticationPolicyBean} and inject this instance into the {@code ApplicationPolicyBean} that represents * the application policy as a whole. *

* * @author Stefan Guilhen */ @XmlType(name = "authenticationJaspiType", propOrder = {"moduleStacks", "modules"}) public class JASPIAuthenticationMetaData extends BasePolicyMetaData { /** the collection of module stacks of the jaspi policy. */ private List moduleStacks; /** *

* Obtains the metadata of the module stacks. *

* * @return a {@code List} containing the module stacks metadata. */ public List getModuleStacks() { return moduleStacks; } /** *

* Sets the metadata of the module stacks. *

* * @param moduleStacks a {@code List} containing the metadata to be set. */ @XmlElement(name = "login-module-stack", type = LoginModuleStackMetaData.class) public void setModuleStacks(List moduleStacks) { this.moduleStacks = moduleStacks; } /* * (non-Javadoc) * * @see org.jboss.security.microcontainer.beans.metadata.BasePolicyMetaData#setModules(java.util.List) */ @Override @XmlElement(name = "auth-module", type = StackRefModuleMetaData.class) public void setModules(List modules) { super.modules = modules; } /* * (non-Javadoc) * * @see org.jboss.security.microcontainer.beans.metadata.BasePolicyMetaData#addBeans(java.lang.String, * java.util.List, org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder) */ @Override public void addBeans(String policyName, List beans, BeanMetaDataBuilder builder) { if (this.moduleStacks != null) { // if there are stacks of login modules, add them to the jaspi policy metadata being created. int stackIndex = 0; List stackMetaData = builder.createList(); for (LoginModuleStackMetaData moduleStack : this.moduleStacks) { String moduleStackName = policyName + "$ModuleStack" + stackIndex++; beans.addAll(moduleStack.getBeans(moduleStackName)); ValueMetaData injectModuleStack = builder.createInject(moduleStackName); stackMetaData.add(injectModuleStack); } builder.addPropertyMetaData("moduleStacks", stackMetaData); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy