001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: AssertionTokenSpec.java,v 1.6 2009/08/29 03:05:57 mallas Exp $ 026 * 027 */ 028 029package com.sun.identity.wss.security; 030 031import org.w3c.dom.Element; 032import java.util.Map; 033import java.util.List; 034import javax.xml.namespace.QName; 035import com.sun.identity.saml.assertion.NameIdentifier; 036 037 038/** 039 * This class implements the interface <code>SecurityTokenSpec</code> to 040 * create <code>SAML1.0</code> and <code>SAML1.1</code> Assertions / Security 041 * Tokens. 042 * 043 * @supported.all.api 044 */ 045public class AssertionTokenSpec implements SecurityTokenSpec { 046 047 private SecurityMechanism securityMechanism = null; 048 private String certAlias = null; 049 private NameIdentifier nameIdentifier = null; 050 private String issuer = null; 051 private String confirmationMethod = null; 052 private Map<QName, List<String>> claims = null; 053 private String appliesTo = null; 054 private long assertionInterval = 300000; 055 private String authMethod = null; 056 private String assertionID = null; 057 private String signingAlias = null; 058 private Element keyInfo = null; 059 060 public AssertionTokenSpec() { 061 062 } 063 064 /** 065 * Construtor 066 * 067 * @param nameIdentifier the name identifier of the authenticated subject. 068 * 069 * @param securityMechanism the security mechanism that should be used 070 * to generate the assertion token. 071 * 072 * @param certAlias the public key certificate alias of the authenticated 073 * subject. 074 */ 075 public AssertionTokenSpec(NameIdentifier nameIdentifier, 076 SecurityMechanism securityMechanism, 077 String certAlias) { 078 079 this.nameIdentifier = nameIdentifier; 080 this.securityMechanism = securityMechanism; 081 this.certAlias = certAlias; 082 } 083 084 /** 085 * Returns the authenticated subject name identifier. 086 * 087 * @return the name identifier of the authenticated subject. 088 */ 089 public NameIdentifier getSenderIdentity() { 090 return nameIdentifier; 091 } 092 093 /** 094 * Sets the sender identity 095 * @param nameID the sender's name identifier. 096 */ 097 public void setSenderIdentity(NameIdentifier nameID) { 098 this.nameIdentifier = nameID; 099 } 100 101 /** 102 * Returns the security mechanism 103 * @return the security mechanism 104 */ 105 public SecurityMechanism getSecurityMechanism() { 106 return securityMechanism; 107 } 108 109 /** 110 * Returns the certficate alias of the subject. 111 * 112 * @return the certificate alias of the subject. 113 */ 114 public String getSubjectCertAlias() { 115 return certAlias; 116 } 117 118 /** 119 * Sets the certificate alias of the subject. 120 * @param certAlias the certificate alias of the subject. 121 */ 122 public void setSubjectCertAlias(String certAlias) { 123 this.certAlias = certAlias; 124 } 125 126 /** 127 * Returns the issuer name. 128 * @return the issuer name. 129 */ 130 public String getIssuer() { 131 return issuer; 132 } 133 134 /** 135 * Sets the issuer name. 136 * @param issuer the issuer name. 137 */ 138 public void setIssuer(String issuer) { 139 this.issuer = issuer; 140 } 141 142 /** 143 * Returns the cliamed attributes 144 * @return the cliamed attributes 145 */ 146 public Map<QName, List<String>> getClaimedAttributes() { 147 return claims; 148 } 149 150 /** 151 * Sets the claimed attributes 152 * @param attrs the claimed attributes 153 */ 154 public void setClaimedAttributes(Map attrs) { 155 this.claims = attrs; 156 } 157 158 /** 159 * Returns the confirmation method. 160 * @return the confirmation method. 161 */ 162 public String getConfirmationMethod() { 163 return confirmationMethod; 164 } 165 166 /** 167 * Sets the confirmation method 168 * @param confirmationMethod the confirmation method 169 */ 170 public void setConfirmationMethod(String confirmationMethod) { 171 this.confirmationMethod = confirmationMethod; 172 } 173 174 /** 175 * Returns the name of the service for which assertion needs to be issued 176 * @return the name of the service for which assertion needs to be issued 177 */ 178 public String getAppliesTo() { 179 return appliesTo; 180 } 181 182 /** 183 * Sets the name of the service for which the assertion needs to be issued. 184 * @param appliesTo the name of the service for which the assertion needs 185 * to be issued. 186 */ 187 public void setAppliesTo(String appliesTo) { 188 this.appliesTo = appliesTo; 189 } 190 191 /** 192 * Returns the assertion interval 193 * @return the assertion interval 194 */ 195 public long getAssertionInterval() { 196 return assertionInterval; 197 } 198 199 /** 200 * Sets the assertion interval 201 * @param interval the assertion interval. 202 */ 203 public void setAssertionInterval(long interval) { 204 this.assertionInterval = interval; 205 } 206 207 /** 208 * Returns the authentication method 209 * @return the authentication method 210 */ 211 public String getAuthenticationMethod() { 212 return authMethod; 213 } 214 215 /** 216 * Sets the authentication method 217 * @param authMethod the authentication method. 218 */ 219 public void setAuthenticationMethod(String authMethod) { 220 this.authMethod = authMethod; 221 } 222 223 /** 224 * Returns the assertion identifier. 225 * @return the assertion identifier. 226 */ 227 public String getAssertionID() { 228 return assertionID; 229 } 230 231 /** 232 * Sets the assertion identifier. 233 * @param assertionID the assertion identifier. 234 */ 235 public void setAssertionID(String assertionID) { 236 this.assertionID = assertionID; 237 } 238 239 /** 240 * Returns the signing alias 241 * @return the signing alias 242 */ 243 public String getSigningAlias() { 244 return signingAlias; 245 } 246 247 /** 248 * Sets the signing cert alias. 249 * @param alias the sigining cert alias. 250 */ 251 public void setSigningAlias(String alias) { 252 this.signingAlias = alias; 253 } 254 255 /** 256 * Returns the keyinfo element. 257 * @return the keyinfo element. 258 */ 259 public Element getKeyInfo() { 260 return keyInfo; 261 } 262 263 /** 264 * Sets the keyinfo element. 265 * @param keyInfo the keyinfo element. 266 */ 267 public void setKeyInfo(Element keyInfo) { 268 this.keyInfo = keyInfo; 269 } 270 271}