You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ru...@apache.org on 2006/03/17 13:39:52 UTC

svn commit: r386630 - in /webservices/axis2/trunk/java/modules/security: ./ src/org/apache/axis2/security/trust/ src/org/apache/axis2/security/trust/types/

Author: ruchithf
Date: Fri Mar 17 04:39:51 2006
New Revision: 386630

URL: http://svn.apache.org/viewcvs?rev=386630&view=rev
Log:
Starting the new WS-Trust impl based on ADB

Added:
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenCanceler.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenIssuer.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcher.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcherConfig.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenValidator.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenVerifier.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenResponseType.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenType.java
    webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestedSecurityTokenType.java
Modified:
    webservices/axis2/trunk/java/modules/security/project.xml

Modified: webservices/axis2/trunk/java/modules/security/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/project.xml?rev=386630&r1=386629&r2=386630&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/project.xml (original)
+++ webservices/axis2/trunk/java/modules/security/project.xml Fri Mar 17 04:39:51 2006
@@ -51,7 +51,12 @@
             <groupId>axis2</groupId>
             <artifactId>axis2-core</artifactId>
             <version>${pom.currentVersion}</version>
-        </dependency>        
+        </dependency>
+        <dependency>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-adb</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>   
         <dependency>
             <groupId>axis2</groupId>
             <artifactId>axis2-doom</artifactId>

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Constants.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+public interface Constants {
+    
+    public final static String WST_NS = "http://schemas.xmlsoap.org/ws/2005/02/trust";
+    public final static String WST_PREFIX = "http://schemas.xmlsoap.org/ws/2005/02/trust";
+    
+    //Local names
+    public final static String REQUEST_TYPE_LN = "RequestType";
+    
+    //RequestTypes
+    public final static String REQ_TYPE_ISSUE = "http://schemas.xmlsoap.org/ws/2005/02/trust/Issue";
+    public final static String REQ_TYPE_VALIDATE = "http://schemas.xmlsoap.org/ws/2005/02/trust/Validate";
+    public final static String REQ_TYPE_RENEW = "http://schemas.xmlsoap.org/ws/2005/02/trust/Renew";
+    public final static String REQ_TYPE_CANCEL = "http://schemas.xmlsoap.org/ws/2005/02/trust/Cancel";
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/Token.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import java.util.HashMap;
+
+import org.apache.ws.commons.om.OMElement;
+
+public class Token {
+    
+    public final static int ISSUED = 1;
+    public final static int EXPIRED = 2;
+    public final static int CANCELLED = 3;
+    public final static int RENEWED = 4;
+    
+    /**
+     * Token identifier
+     */
+    private String id;
+    
+    /**
+     * Current state of the token
+     */
+    private int state = -1;
+    
+    /**
+     * The actual token in its current state
+     */
+    private OMElement token;
+    
+    /**
+     * The original token
+     * This will be differnet from the <code>token</code> if and only
+     * if there was a change in the properties of the token it self
+     */
+    private OMElement originalToken;
+    
+    /**
+     * A bag to hold anyother properties
+     */
+    private HashMap properties;
+
+    /**
+     * A flag to assist the TokenStorage
+     */
+    private boolean chnaged;
+    
+    /**
+     * @return Returns the chnaged.
+     */
+    protected boolean isChnaged() {
+        return chnaged;
+    }
+
+    /**
+     * @param chnaged The chnaged to set.
+     */
+    protected void setChnaged(boolean chnaged) {
+        this.chnaged = chnaged;
+    }
+
+    /**
+     * Create a new token
+     * @param id
+     */
+    public Token(String id){
+        this.id = id;
+    }
+    
+    public Token(String id, OMElement tokenElem) {
+        this.id = id;
+        this.originalToken = tokenElem; 
+    }
+    
+    /**
+     * @return Returns the originalToken.
+     */
+    protected OMElement getOriginalToken() {
+        return originalToken;
+    }
+
+    /**
+     * @param originalToken The originalToken to set.
+     */
+    protected void setOriginalToken(OMElement originalToken) {
+        this.originalToken = originalToken;
+    }
+
+    /**
+     * @return Returns the properties.
+     */
+    protected HashMap getProperties() {
+        return properties;
+    }
+
+    /**
+     * @param properties The properties to set.
+     */
+    protected void setProperties(HashMap properties) {
+        this.properties = properties;
+    }
+
+    /**
+     * @return Returns the state.
+     */
+    protected int getState() {
+        return state;
+    }
+
+    /**
+     * @param state The state to set.
+     */
+    protected void setState(int state) {
+        this.state = state;
+    }
+
+    /**
+     * @return Returns the token.
+     */
+    protected OMElement getToken() {
+        return token;
+    }
+
+    /**
+     * @param token The token to set.
+     */
+    protected void setToken(OMElement token) {
+        this.token = token;
+    }
+
+    /**
+     * @return Returns the id.
+     */
+    protected String getId() {
+        return id;
+    }
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenCanceler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenCanceler.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenCanceler.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenCanceler.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.ws.commons.om.OMElement;
+
+public interface TokenCanceler {
+    
+    public OMElement cancel(OMElement request, MessageContext msgCtx) throws TrustException;
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenIssuer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenIssuer.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenIssuer.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenIssuer.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.ws.commons.om.OMElement;
+
+public interface TokenIssuer {
+
+    public OMElement issue(OMElement request, MessageContext msgCtx) throws TrustException;
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcher.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcher.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcher.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.databinding.types.URI;
+import org.apache.axis2.security.trust.types.RequestSecurityTokenResponseType;
+import org.apache.axis2.security.trust.types.RequestSecurityTokenType;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
+
+public class TokenRequestDispatcher {
+
+    private TokenRequestDispatcherConfig config;
+
+    public TokenRequestDispatcher(TokenRequestDispatcherConfig config)
+            throws TrustException {
+        this.config = config;
+    }
+
+    public TokenRequestDispatcher(OMElement config) throws TrustException {
+        this(TokenRequestDispatcherConfig.load(config));
+    }
+
+    public TokenRequestDispatcher(String configFilePath) throws TrustException {
+        this(TokenRequestDispatcherConfig.load(configFilePath));
+    }
+
+    public RequestSecurityTokenResponseType handle(
+            RequestSecurityTokenType request, MessageContext ctx)
+            throws TrustException {
+        
+        URI reqType = request.getRequestType();
+        URI tokenType = request.getTokenType();
+
+        if (reqType == null
+                || (reqType != null && "".equals(reqType.toString()))) {
+            throw new TrustException(TrustException.INVALID_REQUEST);
+        }
+        if (Constants.REQ_TYPE_ISSUE.equals(reqType)) {
+            TokenIssuer issuer = null;
+            if (tokenType == null
+                    || (tokenType != null && "".equals(tokenType.toString()))) {
+                issuer = config.getDefaultIssuerInstace();
+            } else {
+                issuer = config.getIssuer(tokenType.toString());
+            }
+            OMElement responseToken = issuer.issue(new StAXOMBuilder(request
+                    .getPullParser(null)).getDocumentElement(), ctx);
+            OMElement reqSecTok = responseToken.getOMFactory().createOMElement(
+                    "RequestedSecurityToken", Constants.WST_NS,
+                    Constants.WST_PREFIX);
+            reqSecTok.addChild(responseToken);
+            
+            RequestSecurityTokenResponseType rstrType = 
+                new RequestSecurityTokenResponseType();
+            rstrType.addExtraElement(reqSecTok);
+            return rstrType;
+        } else if(Constants.REQ_TYPE_VALIDATE.equals(reqType)) {
+            throw new UnsupportedOperationException("TODO: handle " +
+                    "validate requests");
+        } else if(Constants.REQ_TYPE_RENEW.equals(reqType)) {
+            throw new UnsupportedOperationException("TODO: handle " +
+                    "renew requests");            
+        } else if(Constants.REQ_TYPE_CANCEL.equals(reqType)) {
+            throw new UnsupportedOperationException("TODO: handle " +
+                    "cancel requests");
+        } else {
+            throw new TrustException(TrustException.INVALID_REQUEST);
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcherConfig.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcherConfig.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcherConfig.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenRequestDispatcherConfig.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import java.io.FileInputStream;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.ws.security.util.Loader;
+
+public class TokenRequestDispatcherConfig {
+
+    private final static QName CONFIG = new QName("token-dispatcher-configuration");
+    public final static QName ISSUER = new QName("issuer");
+    public final static QName TOKEN_TYPE = new QName("tokenType");
+    public final static QName CLASS_ATTR = new QName("class");
+    public final static QName DEFAULT_ATTR = new QName("default");
+    
+    private Hashtable issuers;
+    
+    private String defaultIssuerClassName;
+    
+    
+    public static TokenRequestDispatcherConfig load(OMElement configElem)
+            throws TrustException {
+        
+        if(!CONFIG.equals(configElem.getQName())) {
+            throw new TrustException("incorrectConfiguration");
+        }
+        
+        TokenRequestDispatcherConfig conf = new TokenRequestDispatcherConfig();
+        
+        Iterator issuerElems = configElem.getChildrenWithName(ISSUER);
+        while (issuerElems.hasNext()) {
+            OMElement element = (OMElement) issuerElems.next();
+            //get the class attr
+            String classAttr = element.getAttributeValue(CLASS_ATTR);
+            if(classAttr == null) {
+                throw new TrustException("missingClassName");
+            }
+            String isDefault = element.getAttributeValue(DEFAULT_ATTR);
+            if(isDefault != null && "true".equalsIgnoreCase(isDefault)) {
+                //Use the first default issuer as the default isser
+                if(conf.defaultIssuerClassName != null) {
+                    conf.defaultIssuerClassName = classAttr;
+                }
+            }
+            //Process token types
+            Iterator tokenTypes = element.getChildrenWithName(TOKEN_TYPE);
+            while (tokenTypes.hasNext()) {
+                OMElement type = (OMElement) tokenTypes.next();
+                String value = type.getText();
+                if(value == null) {
+                    throw new TrustException("invalidTokenTypeDefinition",
+                            new String[] { "Issuer", classAttr });
+                }
+                if(conf.issuers != null) {
+                    conf.issuers = new Hashtable();
+                }
+                //If the token type is not aleady declared then add it to the 
+                //table with the issuer classname
+                if(!conf.issuers.keySet().contains(value)) {
+                    conf.issuers.put(value, classAttr);
+                }
+            }
+        }
+        
+        //There must be a defulat issuer
+        if(conf.defaultIssuerClassName == null) {
+            throw new TrustException("defaultIssuerMissing");
+        }
+        
+        return conf;
+    }
+
+    public static TokenRequestDispatcherConfig load(String configFilePath)
+            throws TrustException {
+        FileInputStream fis = null;
+        StAXOMBuilder builder = null;
+        try {
+            fis = new FileInputStream(configFilePath);
+             builder = new StAXOMBuilder(fis);
+        } catch (Exception e) {
+            throw new TrustException("errorLoadingConfigFile", new String[] {configFilePath});
+        }
+        
+        return load(builder.getDocumentElement());
+        
+    }
+    
+    public TokenIssuer getDefaultIssuerInstace() throws TrustException {
+        if(this.defaultIssuerClassName != null) {
+            try {
+                return (TokenIssuer) Loader.loadClass(
+                        this.defaultIssuerClassName).newInstance();
+            } catch (Exception e) {
+                throw new TrustException("cannotLoadClass",
+                        new String[] { this.defaultIssuerClassName }, e);
+            }
+        } else {
+            return null;
+        }
+    }
+    
+    public String getDefaultIssuerName() {
+        return this.defaultIssuerClassName;
+    }
+    
+    
+    public TokenIssuer getIssuer(String tokenType) throws TrustException {
+        String issuerClassName = null;
+        //try to find the isser class name from the tokenType<->issuer map
+        if(this.issuers != null) {
+            issuerClassName = (String)this.issuers.get(tokenType);
+        }
+        //If a specific issuer is not found use the default issuer
+        if(issuerClassName == null) {
+            issuerClassName = this.defaultIssuerClassName;
+        }
+        try {
+            return (TokenIssuer) Loader.loadClass(
+                    this.defaultIssuerClassName).newInstance();
+        } catch (Exception e) {
+            throw new TrustException("cannotLoadClass",
+                    new String[] { this.defaultIssuerClassName }, e);
+        }
+        
+    }
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenStorage.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+public interface TokenStorage {
+    
+    public void add(Token token) throws TrustException;
+    
+    public void update(Token token) throws TrustException;
+    
+    //Utility methods
+    public String[] gettokenIdentifiers() throws TrustException;
+
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenValidator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenValidator.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenValidator.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenValidator.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.ws.commons.om.OMElement;
+
+public interface TokenValidator {
+
+    public OMElement validate(OMElement request, MessageContext msgCtx) throws TrustException;
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenVerifier.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenVerifier.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenVerifier.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TokenVerifier.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.ws.commons.om.OMElement;
+
+public interface TokenVerifier {
+    
+    public OMElement veify(OMElement request, MessageContext msgCtx) throws TrustException;
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/TrustException.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis2.security.trust;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class TrustException extends Exception {
+
+    private static final long serialVersionUID = -445341784514373965L;
+
+    public final static String INVALID_REQUEST = "wst:InvalidRequest";
+    public final static String FAILED_AUTHENTICATION = "wst:FailedAuthentication";
+    public final static String REQUEST_FAILED = "wst:RequestFailed";
+    public final static String INVALID_SECURITY_TOKEN = "wst:InvalidSecurityToken";
+    public final static String AUTHENTICATION_BAD_ELEMENTS = "wst:AuthenticationBadElements";
+    public final static String BAD_REQUEST = "wst:BadRequest";
+    public final static String EXPIRED_DATA = "wst:ExpiredData";
+    public final static String INVALID_TIME_RANGE = "wst:InvalidTimeRange";
+    public final static String INVALID_SCOPE = "wst:InvalidScope";
+    public final static String RENEW_NEEDED = "wst:RenewNeeded";
+    public final static String UNABLE_TO_RENEW = "wst:UnableToRenew";
+    
+    
+    private static ResourceBundle resources;
+
+    private String faultCode;
+    private String faultString;
+    
+    static {
+        try {
+            resources = ResourceBundle.getBundle("org.apache.axis2.security.trust.errors");
+        } catch (MissingResourceException e) {
+            throw new RuntimeException(e.getMessage());
+        }
+    }
+    
+    public TrustException(String faultCode, Object[] args) {
+        super(getMessage(faultCode, args));
+        this.faultCode = faultCode;
+        this.faultString = getMessage(faultCode, args);
+    }
+    
+    public TrustException(String faultCode) {
+        this(faultCode, (Object[])null);
+    }
+    
+    public TrustException(String faultCode, Object[] args, Throwable e) {
+        super(getMessage(faultCode, args),e);
+        this.faultCode = faultCode;
+        this.faultString = getMessage(faultCode, args);
+    }
+    
+    public TrustException(String faultCode, Throwable e) {
+        this(faultCode, null, e);
+    }
+
+    /**
+     * get the message from resource bundle.
+     * <p/>
+     *
+     * @return the message translated from the property (message) file.
+     */
+    private static String getMessage(String faultCode, Object[] args) {
+        String msg = null;
+        try {
+            msg = MessageFormat.format(resources.getString(faultCode), args);
+        } catch (MissingResourceException e) {
+            throw new RuntimeException("Undefined '" + faultCode + "' resource property");
+        }
+        return msg;
+    }
+
+    /**
+     * @return Returns the faultCode.
+     */
+    protected String getFaultCode() {
+        return faultCode;
+    }
+
+    /**
+     * @return Returns the faultString.
+     */
+    protected String getFaultString() {
+        return faultString;
+    }
+    
+    
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/errors.properties Fri Mar 17 04:39:51 2006
@@ -0,0 +1,19 @@
+wst:InvalidRequest = The request was invalid or malformed
+wst:FailedAuthentication = Authentication failed
+wst:RequestFailed = The specified request failed
+wst:InvalidSecurityToken = Security token has been revoked
+wst:AuthenticationBadElements = Insufficient Digest Elements
+wst:BadRequest = The specified RequestSecurityToken is not understood
+wst:ExpiredData = The request data is out-of-date
+wst:InvalidTimeRange = The requested time range is invalid or unsupported
+wst:InvalidScope = The request scope is invalid or unsupported
+wst:RenewNeeded = A renewable security token has expired
+wst:UnableToRenew = The requested renewal failed
+
+
+incorrectConfiguration = The given configuration element is not a "token-dispatcher-configuration" element
+missingClassName = Class attribute missing
+cannotLoadClass = Error in loading and instanciating the class \"{0}\"
+invalidTokenTypeDefinition = Invalid 'tokenType' definition in \"{0}\" : \"{1}\"
+errorLoadingConfigFile = Error in loading configuration file : \"{0}\"
+defaultIssuerMissing = The default issuer must be specified
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenResponseType.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenResponseType.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenResponseType.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenResponseType.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,339 @@
+/**
+ * RequestSecurityTokenResponseType.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+
+package org.apache.axis2.security.trust.types;
+
+/**
+ * RequestSecurityTokenResponseType bean class
+ */
+
+public class RequestSecurityTokenResponseType implements
+        org.apache.axis2.databinding.ADBBean {
+    /*
+     * This type was generated from the piece of schema that had name =
+     * RequestSecurityTokenResponseType Namespace URI =
+     * http://schemas.xmlsoap.org/ws/2005/02/trust Namespace Prefix = ns2
+     */
+
+    /**
+     * field for TokenType
+     */
+
+    protected org.apache.axis2.databinding.types.URI localTokenType;
+
+    /*
+     * This tracker boolean wil be used to detect whether the user called the
+     * set method for this attribute. It will be used to determine whether to
+     * include this field in the serialized XML
+     */
+    protected boolean localTokenTypeTracker = false;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.axis2.databinding.types.URI
+     */
+    public org.apache.axis2.databinding.types.URI getTokenType() {
+        return localTokenType;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            TokenType
+     */
+    public void setTokenType(org.apache.axis2.databinding.types.URI param) {
+
+        // update the setting tracker
+        localTokenTypeTracker = true;
+
+        this.localTokenType = param;
+    }
+
+    /**
+     * field for RequestedSecurityToken
+     */
+
+    protected org.apache.axis2.security.trust.types.RequestedSecurityTokenType localRequestedSecurityToken;
+
+    /*
+     * This tracker boolean wil be used to detect whether the user called the
+     * set method for this attribute. It will be used to determine whether to
+     * include this field in the serialized XML
+     */
+    protected boolean localRequestedSecurityTokenTracker = false;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.xmlsoap.schemas.ws._2005._02.trust.RequestedSecurityTokenType
+     */
+    public org.apache.axis2.security.trust.types.RequestedSecurityTokenType getRequestedSecurityToken() {
+        return localRequestedSecurityToken;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            RequestedSecurityToken
+     */
+    public void setRequestedSecurityToken(
+            org.apache.axis2.security.trust.types.RequestedSecurityTokenType param) {
+
+        // update the setting tracker
+        localRequestedSecurityTokenTracker = true;
+
+        this.localRequestedSecurityToken = param;
+    }
+
+    /**
+     * field for ExtraElement* This was an Array!
+     */
+
+    protected org.apache.ws.commons.om.OMElement[] localExtraElement;
+
+    /*
+     * This tracker boolean wil be used to detect whether the user called the
+     * set method for this attribute. It will be used to determine whether to
+     * include this field in the serialized XML
+     */
+    protected boolean localExtraElementTracker = false;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.ws.commons.om.OMElement[]
+     */
+    public org.apache.ws.commons.om.OMElement[] getExtraElement() {
+        return localExtraElement;
+    }
+
+    /**
+     * validate the array for ExtraElement
+     */
+    protected void validateExtraElement(
+            org.apache.ws.commons.om.OMElement[] param) {
+
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            ExtraElement
+     */
+    public void setExtraElement(org.apache.ws.commons.om.OMElement[] param) {
+
+        validateExtraElement(param);
+
+        // update the setting tracker
+        localExtraElementTracker = true;
+
+        this.localExtraElement = param;
+    }
+
+    /**
+     * Auto generated add method for the array for convenience
+     * 
+     * @param param
+     *            org.apache.ws.commons.om.OMElement
+     */
+    public void addExtraElement(org.apache.ws.commons.om.OMElement param) {
+        if (localExtraElement == null) {
+            localExtraElement = new org.apache.ws.commons.om.OMElement[] {};
+        }
+        java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil
+                .toList(localExtraElement);
+        list.add(param);
+        this.localExtraElement = (org.apache.ws.commons.om.OMElement[]) list
+                .toArray(new org.apache.ws.commons.om.OMElement[list.size()]);
+
+    }
+
+    /**
+     * field for Context* This was an Attribute!
+     */
+
+    protected org.apache.axis2.databinding.types.URI localContext;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.axis2.databinding.types.URI
+     */
+    public org.apache.axis2.databinding.types.URI getContext() {
+        return localContext;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            Context
+     */
+    public void setContext(org.apache.axis2.databinding.types.URI param) {
+
+        this.localContext = param;
+    }
+
+    /**
+     * databinding method to get an XML representation of this object
+     * 
+     */
+    public javax.xml.stream.XMLStreamReader getPullParser(
+            javax.xml.namespace.QName qName) {
+
+        java.util.ArrayList elementList = new java.util.ArrayList();
+        java.util.ArrayList attribList = new java.util.ArrayList();
+
+        if (localTokenTypeTracker) {
+            elementList
+                    .add(new javax.xml.namespace.QName(
+                            "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                            "TokenType"));
+
+            elementList.add(org.apache.axis2.databinding.utils.ConverterUtil
+                    .convertToString(localTokenType));
+        }
+        if (localRequestedSecurityTokenTracker) {
+            elementList.add(new javax.xml.namespace.QName(
+                    "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                    "RequestedSecurityToken"));
+
+            if (localRequestedSecurityToken == null) {
+                throw new RuntimeException(
+                        "RequestedSecurityToken cannot be null!!");
+            }
+            elementList.add(localRequestedSecurityToken);
+        }
+        if (localExtraElementTracker) {
+            elementList.add(new javax.xml.namespace.QName("", "extraElement"));
+
+            if (localExtraElement == null) {
+                throw new RuntimeException("extraElement cannot be null!!");
+            }
+            elementList.add(localExtraElement);
+        }
+        attribList.add(new javax.xml.namespace.QName(
+                "http://schemas.xmlsoap.org/ws/2005/02/trust", "Context"));
+        attribList.add(org.apache.axis2.databinding.utils.ConverterUtil
+                .convertToString(localContext));
+
+        return org.apache.axis2.databinding.utils.ADBPullParser
+                .createPullParser(qName, elementList.toArray(), attribList
+                        .toArray());
+
+    }
+
+    /**
+     * utility method to http://www.w3.org/2001/XMLSchema-instance
+     */
+
+    /**
+     * Factory class that keeps the parse method
+     */
+    public static class Factory {
+        /**
+         * static method to create the object
+         */
+        public static RequestSecurityTokenResponseType parse(
+                javax.xml.stream.XMLStreamReader reader)
+                throws java.lang.Exception {
+            RequestSecurityTokenResponseType object = new RequestSecurityTokenResponseType();
+            try {
+                int event = reader.getEventType();
+
+                // event better be a START_ELEMENT. if not we should go up to
+                // the start element here
+                while (event != javax.xml.stream.XMLStreamReader.START_ELEMENT) {
+                    event = reader.next();
+                }
+
+                java.lang.String tempAttribContext = reader.getAttributeValue(
+                        "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                        "Context");
+                if (tempAttribContext != null) {
+                    object
+                            .setContext(org.apache.axis2.databinding.utils.ConverterUtil
+                                    .convertToanyURI(tempAttribContext));
+                }
+
+                org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine1 = new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
+                javax.xml.namespace.QName startQname1 = new javax.xml.namespace.QName(
+                        "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                        "TokenType");
+                stateMachine1.setElementNameToTest(startQname1);
+                stateMachine1.read(reader);
+                object.setTokenType(
+
+                org.apache.axis2.databinding.utils.ConverterUtil
+                        .convertToanyURI(stateMachine1.getText()));
+
+                object
+                        .setRequestedSecurityToken(org.apache.axis2.security.trust.types.RequestedSecurityTokenType.Factory
+                                .parse(reader));
+
+                java.util.ArrayList list3 = new java.util.ArrayList();
+                boolean loopDone3 = false;
+                javax.xml.namespace.QName startQname3 = new javax.xml.namespace.QName(
+                        "", "extraElement");
+
+                boolean loopDone3_internal = false;
+
+                while (!loopDone3_internal) {
+                    if (reader.isStartElement()
+                            && startQname3.equals(reader.getName())) {
+                        loopDone3_internal = true;
+                    } else {
+                        reader.next();
+                    }
+                }
+
+                while (!loopDone3) {
+                    event = reader.getEventType();
+                    if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event
+                            && startQname3.equals(reader.getName())) {
+
+                        // We need to wrap the reader so that it produces a fake
+                        // START_DOCUEMENT event
+                        org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder3 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(
+                                new org.apache.axis2.util.StreamWrapper(reader),
+                                startQname3);
+
+                        list3.add(builder3.getOMElement());
+
+                    } else if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event
+                            && !startQname3.equals(reader.getName())) {
+                        loopDone3 = true;
+                    } else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event
+                            && !startQname3.equals(reader.getName())) {
+                        loopDone3 = true;
+                    } else if (javax.xml.stream.XMLStreamConstants.END_DOCUMENT == event) {
+                        loopDone3 = true;
+                    } else {
+                        reader.next();
+                    }
+
+                }
+
+                object
+                        .setExtraElement((org.apache.ws.commons.om.OMElement[]) org.apache.axis2.databinding.utils.ConverterUtil
+                                .convertToArray(
+                                        org.apache.ws.commons.om.OMElement.class,
+                                        list3));
+
+            } catch (javax.xml.stream.XMLStreamException e) {
+                throw new java.lang.Exception(e);
+            }
+
+            return object;
+        }
+    }// end of factory class
+
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenType.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenType.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenType.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestSecurityTokenType.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,348 @@
+/**
+ * RequestSecurityTokenType.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+
+package org.apache.axis2.security.trust.types;
+
+/**
+ * RequestSecurityTokenType bean class
+ */
+
+public class RequestSecurityTokenType implements
+        org.apache.axis2.databinding.ADBBean {
+    /*
+     * This type was generated from the piece of schema that had name =
+     * RequestSecurityTokenType Namespace URI =
+     * http://schemas.xmlsoap.org/ws/2005/02/trust Namespace Prefix = ns2
+     */
+
+    /**
+     * field for TokenType
+     */
+
+    protected org.apache.axis2.databinding.types.URI localTokenType;
+
+    /*
+     * This tracker boolean wil be used to detect whether the user called the
+     * set method for this attribute. It will be used to determine whether to
+     * include this field in the serialized XML
+     */
+    protected boolean localTokenTypeTracker = false;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.axis2.databinding.types.URI
+     */
+    public org.apache.axis2.databinding.types.URI getTokenType() {
+        return localTokenType;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            TokenType
+     */
+    public void setTokenType(org.apache.axis2.databinding.types.URI param) {
+
+        // update the setting tracker
+        localTokenTypeTracker = true;
+
+        this.localTokenType = param;
+    }
+
+    /**
+     * field for RequestType
+     */
+
+    protected org.apache.axis2.databinding.types.URI localRequestType;
+
+    /*
+     * This tracker boolean wil be used to detect whether the user called the
+     * set method for this attribute. It will be used to determine whether to
+     * include this field in the serialized XML
+     */
+    protected boolean localRequestTypeTracker = false;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.axis2.databinding.types.URI
+     */
+    public org.apache.axis2.databinding.types.URI getRequestType() {
+        return localRequestType;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            RequestType
+     */
+    public void setRequestType(org.apache.axis2.databinding.types.URI param) {
+
+        // update the setting tracker
+        localRequestTypeTracker = true;
+
+        this.localRequestType = param;
+    }
+
+    /**
+     * field for ExtraElement* This was an Array!
+     */
+
+    protected org.apache.ws.commons.om.OMElement[] localExtraElement;
+
+    /*
+     * This tracker boolean wil be used to detect whether the user called the
+     * set method for this attribute. It will be used to determine whether to
+     * include this field in the serialized XML
+     */
+    protected boolean localExtraElementTracker = false;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.ws.commons.om.OMElement[]
+     */
+    public org.apache.ws.commons.om.OMElement[] getExtraElement() {
+        return localExtraElement;
+    }
+
+    /**
+     * validate the array for ExtraElement
+     */
+    protected void validateExtraElement(
+            org.apache.ws.commons.om.OMElement[] param) {
+
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            ExtraElement
+     */
+    public void setExtraElement(org.apache.ws.commons.om.OMElement[] param) {
+
+        validateExtraElement(param);
+
+        // update the setting tracker
+        localExtraElementTracker = true;
+
+        this.localExtraElement = param;
+    }
+
+    /**
+     * Auto generated add method for the array for convenience
+     * 
+     * @param param
+     *            org.apache.ws.commons.om.OMElement
+     */
+    public void addExtraElement(org.apache.ws.commons.om.OMElement param) {
+        if (localExtraElement == null) {
+            localExtraElement = new org.apache.ws.commons.om.OMElement[] {};
+        }
+        java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil
+                .toList(localExtraElement);
+        list.add(param);
+        this.localExtraElement = (org.apache.ws.commons.om.OMElement[]) list
+                .toArray(new org.apache.ws.commons.om.OMElement[list.size()]);
+
+    }
+
+    /**
+     * field for Context* This was an Attribute!
+     */
+
+    protected org.apache.axis2.databinding.types.URI localContext;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.axis2.databinding.types.URI
+     */
+    public org.apache.axis2.databinding.types.URI getContext() {
+        return localContext;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            Context
+     */
+    public void setContext(org.apache.axis2.databinding.types.URI param) {
+
+        this.localContext = param;
+    }
+
+    /**
+     * databinding method to get an XML representation of this object
+     * 
+     */
+    public javax.xml.stream.XMLStreamReader getPullParser(
+            javax.xml.namespace.QName qName) {
+
+        java.util.ArrayList elementList = new java.util.ArrayList();
+        java.util.ArrayList attribList = new java.util.ArrayList();
+
+        if (localTokenTypeTracker) {
+            elementList
+                    .add(new javax.xml.namespace.QName(
+                            "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                            "TokenType"));
+
+            elementList.add(org.apache.axis2.databinding.utils.ConverterUtil
+                    .convertToString(localTokenType));
+        }
+        if (localRequestTypeTracker) {
+            elementList.add(new javax.xml.namespace.QName(
+                    "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                    "RequestType"));
+
+            elementList.add(org.apache.axis2.databinding.utils.ConverterUtil
+                    .convertToString(localRequestType));
+        }
+        if (localExtraElementTracker) {
+            elementList.add(new javax.xml.namespace.QName("", "extraElement"));
+
+            if (localExtraElement == null) {
+                throw new RuntimeException("extraElement cannot be null!!");
+            }
+            elementList.add(localExtraElement);
+        }
+        attribList.add(new javax.xml.namespace.QName(
+                "http://schemas.xmlsoap.org/ws/2005/02/trust", "Context"));
+        attribList.add(org.apache.axis2.databinding.utils.ConverterUtil
+                .convertToString(localContext));
+
+        return org.apache.axis2.databinding.utils.ADBPullParser
+                .createPullParser(qName, elementList.toArray(), attribList
+                        .toArray());
+
+    }
+
+    /**
+     * utility method to http://www.w3.org/2001/XMLSchema-instance
+     */
+
+    /**
+     * Factory class that keeps the parse method
+     */
+    public static class Factory {
+        /**
+         * static method to create the object
+         */
+        public static RequestSecurityTokenType parse(
+                javax.xml.stream.XMLStreamReader reader)
+                throws java.lang.Exception {
+            RequestSecurityTokenType object = new RequestSecurityTokenType();
+            try {
+                int event = reader.getEventType();
+
+                // event better be a START_ELEMENT. if not we should go up to
+                // the start element here
+                while (event != javax.xml.stream.XMLStreamReader.START_ELEMENT) {
+                    event = reader.next();
+                }
+
+                java.lang.String tempAttribContext = reader.getAttributeValue(
+                        "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                        "Context");
+                if (tempAttribContext != null) {
+                    object
+                            .setContext(org.apache.axis2.databinding.utils.ConverterUtil
+                                    .convertToanyURI(tempAttribContext));
+                }
+
+                org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine1 = new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
+                javax.xml.namespace.QName startQname1 = new javax.xml.namespace.QName(
+                        "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                        "TokenType");
+                stateMachine1.setElementNameToTest(startQname1);
+                stateMachine1.read(reader);
+                object.setTokenType(
+
+                org.apache.axis2.databinding.utils.ConverterUtil
+                        .convertToanyURI(stateMachine1.getText()));
+
+                // Move to a start element
+                event = reader.getEventType();
+                while (event != javax.xml.stream.XMLStreamReader.START_ELEMENT) {
+                    event = reader.next();
+                }
+
+                org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine stateMachine2 = new org.apache.axis2.databinding.utils.SimpleElementReaderStateMachine();
+                javax.xml.namespace.QName startQname2 = new javax.xml.namespace.QName(
+                        "http://schemas.xmlsoap.org/ws/2005/02/trust",
+                        "RequestType");
+                stateMachine2.setElementNameToTest(startQname2);
+                stateMachine2.read(reader);
+                object.setRequestType(
+
+                org.apache.axis2.databinding.utils.ConverterUtil
+                        .convertToanyURI(stateMachine2.getText()));
+
+                java.util.ArrayList list3 = new java.util.ArrayList();
+                boolean loopDone3 = false;
+                javax.xml.namespace.QName startQname3 = new javax.xml.namespace.QName(
+                        "", "extraElement");
+
+                boolean loopDone3_internal = false;
+
+                while (!loopDone3_internal) {
+                    if (reader.isStartElement()
+                            && startQname3.equals(reader.getName())) {
+                        loopDone3_internal = true;
+                    } else {
+                        reader.next();
+                    }
+                }
+
+                while (!loopDone3) {
+                    event = reader.getEventType();
+                    if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event
+                            && startQname3.equals(reader.getName())) {
+
+                        // We need to wrap the reader so that it produces a fake
+                        // START_DOCUEMENT event
+                        org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder3 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(
+                                new org.apache.axis2.util.StreamWrapper(reader),
+                                startQname3);
+
+                        list3.add(builder3.getOMElement());
+
+                    } else if (javax.xml.stream.XMLStreamConstants.START_ELEMENT == event
+                            && !startQname3.equals(reader.getName())) {
+                        loopDone3 = true;
+                    } else if (javax.xml.stream.XMLStreamConstants.END_ELEMENT == event
+                            && !startQname3.equals(reader.getName())) {
+                        loopDone3 = true;
+                    } else if (javax.xml.stream.XMLStreamConstants.END_DOCUMENT == event) {
+                        loopDone3 = true;
+                    } else {
+                        reader.next();
+                    }
+
+                }
+
+                object
+                        .setExtraElement((org.apache.ws.commons.om.OMElement[]) org.apache.axis2.databinding.utils.ConverterUtil
+                                .convertToArray(
+                                        org.apache.ws.commons.om.OMElement.class,
+                                        list3));
+
+            } catch (javax.xml.stream.XMLStreamException e) {
+                throw new java.lang.Exception(e);
+            }
+
+            return object;
+        }
+    }// end of factory class
+
+}

Added: webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestedSecurityTokenType.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestedSecurityTokenType.java?rev=386630&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestedSecurityTokenType.java (added)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/axis2/security/trust/types/RequestedSecurityTokenType.java Fri Mar 17 04:39:51 2006
@@ -0,0 +1,124 @@
+/**
+ * RequestedSecurityTokenType.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+
+package org.apache.axis2.security.trust.types;
+
+/**
+ * RequestedSecurityTokenType bean class
+ */
+
+public class RequestedSecurityTokenType implements
+        org.apache.axis2.databinding.ADBBean {
+    /*
+     * This type was generated from the piece of schema that had name =
+     * RequestedSecurityTokenType Namespace URI =
+     * http://schemas.xmlsoap.org/ws/2005/02/trust Namespace Prefix = ns2
+     */
+
+    /**
+     * field for ExtraElement
+     */
+
+    protected org.apache.ws.commons.om.OMElement localExtraElement;
+
+    /**
+     * Auto generated getter method
+     * 
+     * @return org.apache.ws.commons.om.OMElement
+     */
+    public org.apache.ws.commons.om.OMElement getExtraElement() {
+        return localExtraElement;
+    }
+
+    /**
+     * Auto generated setter method
+     * 
+     * @param param
+     *            ExtraElement
+     */
+    public void setExtraElement(org.apache.ws.commons.om.OMElement param) {
+
+        this.localExtraElement = param;
+    }
+
+    /**
+     * databinding method to get an XML representation of this object
+     * 
+     */
+    public javax.xml.stream.XMLStreamReader getPullParser(
+            javax.xml.namespace.QName qName) {
+
+        java.util.ArrayList elementList = new java.util.ArrayList();
+        java.util.ArrayList attribList = new java.util.ArrayList();
+
+        elementList.add(new javax.xml.namespace.QName("", "extraElement"));
+
+        if (localExtraElement == null) {
+            throw new RuntimeException("extraElement cannot be null!!");
+        }
+        elementList.add(localExtraElement);
+
+        return org.apache.axis2.databinding.utils.ADBPullParser
+                .createPullParser(qName, elementList.toArray(), attribList
+                        .toArray());
+
+    }
+
+    /**
+     * utility method to http://www.w3.org/2001/XMLSchema-instance
+     */
+
+    /**
+     * Factory class that keeps the parse method
+     */
+    public static class Factory {
+        /**
+         * static method to create the object
+         */
+        public static RequestedSecurityTokenType parse(
+                javax.xml.stream.XMLStreamReader reader)
+                throws java.lang.Exception {
+            RequestedSecurityTokenType object = new RequestedSecurityTokenType();
+            try {
+                int event = reader.getEventType();
+
+                // event better be a START_ELEMENT. if not we should go up to
+                // the start element here
+                while (event != javax.xml.stream.XMLStreamReader.START_ELEMENT) {
+                    event = reader.next();
+                }
+
+                boolean loopDone1 = false;
+                // move to the start element
+                while (!loopDone1) {
+                    if (reader.isStartElement()) {
+                        loopDone1 = true;
+                    } else {
+                        reader.next();
+                    }
+                }
+
+                // use the QName from the parser as the name for the builder
+                javax.xml.namespace.QName startQname1 = reader.getName();
+
+                // We need to wrap the reader so that it produces a fake
+                // START_DOCUEMENT event
+                // this is needed by the builder classes
+                org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(
+                        new org.apache.axis2.util.StreamWrapper(reader),
+                        startQname1);
+                object.setExtraElement(builder1.getOMElement());
+
+            } catch (javax.xml.stream.XMLStreamException e) {
+                throw new java.lang.Exception(e);
+            }
+
+            return object;
+        }
+    }// end of factory class
+
+}