Filter:   InfoImg
download AssertionContextImpl.java
Language: Java
Copyright: (c) 2005 by Sun Microsystems/Ray Lai under Common Development and Distribution License
LOC: 62
Project Info
identity management security patterns(identitypatterns)
Server: java.net
Type: cvs
[Show Code]






[Show Code]
...terns\src\com\csp\identity\
   Assertion.java
   AssertionBuilder.java
   AssertionContext.java
   AssertionContextImpl.java
   Attribute.java
   AttributeStatement.java
   ...nticationStatement.java
   ...nDecisionStatement.java
   BinaryToken.java
   CredentialTokenizer.java
   SecurityToken.java
   SSOContext.java
   SSOContextImpl.java
   SSODelegator.java
   SSODelegatorException.java
   SSODelegatorFactory.java
   ...legatorFactoryImpl.java
   ...er_SampleFunction1.java
   SSOServiceProvider.java
   ...rviceProviderImpl1.java
   ...rviceProviderImpl2.java
   Subject.java
   TokenContext.java
   TokenContextImpl.java
   UsernameToken.java
   X509CertToken.java

/*
 * Program:    AssertionContextImpl.java
 * Purpose:    Implementation for SAML assertion context
 * @author     Ray Lai (ray.lai@sun.com)
 * @version    1.0
 * Updated:    April 17, 2005, 6:54 PM
 * Copyright:  (c) 2005 by Sun Microsystems/Ray Lai under Common Development and Distribution License
 * Remarks:    Full program and documentation will be available under developer.java.net
 *             For simplicity, logger class is removed.
 * =====================================================================================
 *
 */

package com.csp.identity;

import org.w3c.dom.Document;

public class AssertionContextImpl implements com.csp.identity.AssertionContext {
    
    protected String authMethod;
    protected String assertionType;
    protected com.csp.identity.AuthenticationStatement authStatement;
    protected com.csp.identity.AuthorizationDecisionStatement authzDecisionStatement;
    protected com.csp.identity.AttributeStatement attributeStatement;
    protected Document domTree;

    
    /** Constructor - Creates a new instance of AssertionContextImpl */
    public AssertionContextImpl() {
 
    }

    /** set assertion type
     *
     *  @param String assertion type, e.g. authentication, attribute
     **/
    public void setAssertionType(String assertionType) {
        this.assertionType = assertionType;
    }
    
    /** create SSO token
     *
     *  @param Object security token
     **/
    public void createSSOToken(Object securityToken) {
        // to be implemented
    }

    /** check for valid SAML statement
     *
     *  @return boolean true/falase
     **/
    public boolean isValidStatement() {
        // to be implemented
        return false; 
    }

    /** set authentication method
     *
     *  @param String authentication method
     **/
    public void setAuthenticationMethod(String authMethod) {
        this.authMethod = authMethod;
    }
    
    /** get authentication method
     *
     *  @return String authentication method
     **/
    public String getAuthenticationMethod() {
        return this.authMethod;
    }
    
    /** create SAML assertion statement
     *  
     *  Note - the @return has not been implemented.
     *
     *  @return Document xml document
     **/
    public Document createAssertionStatement(Object assertObject) {
        
        if (this.assertionType.equals(com.csp.identity.AuthenticationStatement.ASSERTION_TYPE)) {
            
            // create SAML authentication statement using your service provider class
             authStatement = (com.csp.identity.AuthenticationStatement)assertObject;
             
             System.out.println("subjectName=" + authStatement.getSubject().getSubjectName());
             authStatement.create();
        }
        else if (this.assertionType.equals(com.csp.identity.AuthorizationDecisionStatement.ASSERTION_TYPE)) {
            
            // create SAML authorization decision statement using your service provider class
            authzDecisionStatement = (com.csp.identity.AuthorizationDecisionStatement)assertObject;
            
            System.out.println("subjectName=" + authzDecisionStatement.getSubject().getSubjectName());
            authzDecisionStatement.create();
        }
        else if (this.assertionType.equals(com.csp.identity.AttributeStatement.ASSERTION_TYPE)) {
            
            // create SAML authorization decision statement using your service provider class
            attributeStatement = (com.csp.identity.AttributeStatement)assertObject;
            
            System.out.println("subjectName=" + authzDecisionStatement.getSubject().getSubjectName());
            attributeStatement.create();
        }    
        return null;
    }

    /** get SAML assertion statement
     *
     *  @return Document xml document
     **/
    public Document getAssertionStatement() {
        // to be implemented
        return null;
    }
    
    /** remove assertion statement
     *
     **/
    public void removeAssertionStatement() {
        // to be implemented
    }
    
    /** create assertion reply
     *
     * @return Document xml document
     **/
    public Document createAssertionReply(Object assertionRequest) {
        // to be implemented
        return null;
    }
    
    /** get assertion reply
     *
     * @return Document xml document
     **/
    public Document getAssertionReply() {
        // to be implemented
        return null;
    }
    
    /** remove assertion reply
     *
     **/
    public void removeAssertionReply() {
        // to be implemented
    }
    
    /** set protocol binding
     *
     * @param String protocol binding
     **/
    public void setProtocolBinding (String protocolBinding){
        // to be implemented
    }
    
    /** get protocol binding
     *
     * @return String protocol binding
     **/
    public String getProtocolBinding() {
        // to be implemented
        return null;
    }
}