123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
/* * 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; } }