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: STSConfig.java,v 1.10 2009/11/16 21:52:58 mallas Exp $ 026 * 027 */ 028 029/* 030 * Portions Copyright 2013 ForgeRock AS 031 */ 032package com.sun.identity.wss.provider; 033 034import java.util.Set; 035import java.util.List; 036import java.util.ArrayList; 037import com.sun.identity.wss.sts.STSConstants; 038 039/** 040 * This abstract class <code>STSConfig</code> represents the 041 * configuration of a Security Token Service client entity. It extends 042 * <code>TrustAuthorityConfig</code>. 043 * 044 * <p>This class can be extended to define the trust authority config 045 * which is WS-Trust protocol based client (STS client) configuration. 046 * 047 * <p>Pluggable implementation of this abstract class can choose to store this 048 * configuration in desired configuration store. This pluggable implementation 049 * class can be configured in client's AMConfig.properties as value of 050 * "com.sun.identity.wss.sts.config.plugin" property 051 * for STS client configuration. 052 * 053 * <p>All the static methods in this class are for the persistent 054 * operations. 055 * 056 * @supported.all.api 057 */ 058public abstract class STSConfig extends TrustAuthorityConfig { 059 060 protected String mexEndpoint = null; 061 protected String stsConfigName = null; 062 protected String kdcDomain = null; 063 protected String kdcServer = null; 064 protected String ticketCacheDir = null; 065 protected String servicePrincipal = null; 066 protected String protocolVersion = "1.0"; 067 protected Set samlAttributes = null; 068 protected boolean includeMemberships = false; 069 protected String nameIDMapper = null; 070 protected String attributeNS = null; 071 protected String keyType = STSConstants.PUBLIC_KEY; 072 protected List<String> requestedClaims = new ArrayList(); 073 protected String dnsClaim = null; 074 protected List signedElements = new ArrayList(); 075 076 /** Creates a new instance of STSConfig */ 077 public STSConfig() { 078 } 079 080 /** 081 * Returns STS Mex endpoint. 082 * @return STS Mex endpoint 083 */ 084 public String getMexEndpoint() { 085 return mexEndpoint; 086 } 087 088 /** 089 * Sets STS Mex endpoint. 090 * @param mexEndpoint STS Mex endpoint 091 * 092 */ 093 public void setMexEndpoint(String mexEndpoint) { 094 this.mexEndpoint = mexEndpoint; 095 } 096 097 /** 098 * Returns the keytype. Example of keytype are symmetric or asymmetric 099 * @return the keytype. 100 */ 101 public String getKeyType() { 102 return keyType; 103 } 104 105 /** 106 * Sets the keytype 107 * @param keyType 108 */ 109 public void setKeyType(String keyType) { 110 this.keyType = keyType; 111 } 112 113 /** 114 * Returns STS configuration name. 115 * @return STS configuration name 116 */ 117 public String getSTSConfigName() { 118 return stsConfigName; 119 } 120 121 /** 122 * Sets STS configuration name. 123 * @param stsConfigName STS configuration name 124 * 125 */ 126 public void setSTSConfigName(String stsConfigName) { 127 this.stsConfigName = stsConfigName; 128 } 129 130 /** 131 * Returns Kerberos Domain Controller Domain. 132 * @return Kerberos Domain Controller Domain 133 */ 134 135 public String getKDCDomain() { 136 return kdcDomain; 137 } 138 139 /** 140 * Sets Kerberos Domain Controller Domain. 141 * @param domain Kerberos Domain Controller Domain 142 */ 143 public void setKDCDomain(String domain) { 144 this.kdcDomain = domain; 145 } 146 147 /** 148 * Returns Kerberos Domain Controller Server. 149 * @return Kerberos Domain Controller Server. 150 */ 151 public String getKDCServer() { 152 return kdcServer; 153 } 154 155 /** 156 * Sets Kerberos Domain Controller Server. 157 * @param kdcServer Kerberos Domain Controller Server 158 */ 159 public void setKDCServer(String kdcServer) { 160 this.kdcServer = kdcServer; 161 } 162 163 /** 164 * Returns the kerberos ticket cache directory. 165 * This method is used by the web services client to get the kerberos 166 * ticket cache directory. 167 * @return kerberos ticket cache dir 168 */ 169 public String getKerberosTicketCacheDir() { 170 return ticketCacheDir; 171 } 172 173 /** 174 * Sets kerberos ticket cache directory. 175 * @param cacheDir kerberos ticket cache dir 176 */ 177 public void setKerberosTicketCacheDir(String cacheDir) { 178 this.ticketCacheDir = cacheDir; 179 } 180 181 /** 182 * Returns kerberos service principal. 183 * @return the kerberos service principal 184 */ 185 public String getKerberosServicePrincipal() { 186 return servicePrincipal; 187 } 188 189 /** 190 * Sets kerberos service principal. 191 * @param principal the kerberos service principal. 192 */ 193 public void setKerberosServicePrincipal(String principal) { 194 this.servicePrincipal = principal; 195 } 196 197 /** 198 * Returns the protocol version. 199 * @return the protocol version 200 */ 201 public String getProtocolVersion() { 202 return protocolVersion; 203 } 204 /** 205 * Sets the protocol version. 206 * @param version the protocol version. 207 */ 208 public void setProtocolVersion(String version) { 209 this.protocolVersion = version; 210 } 211 212 /** 213 * Returns the SAML Attribute Mapping list. This method is used by the 214 * WSP configuration when enabled for SAML. 215 */ 216 public Set getSAMLAttributeMapping() { 217 return samlAttributes; 218 } 219 220 /** 221 * Sets the list of SAML attribute mappings. This method is used by the 222 * WSP configuration when enabled for SAML. 223 * @param attributeMap the list of SAML attribute mapping 224 */ 225 public void setSAMLAttributeMapping(Set attributeMap) { 226 this.samlAttributes = attributeMap; 227 } 228 229 /** 230 * Checks if the memberships should be included in the SAML attribute 231 * mapping. 232 * @return true if the memberships are included. 233 */ 234 public boolean shouldIncludeMemberships() { 235 return includeMemberships; 236 } 237 238 /** 239 * Sets a flag to include memberships for SAML attribute mapping. 240 * @param include boolean flag to indicate if the memberships needs to 241 * be included. 242 */ 243 public void setIncludeMemberships(boolean include) { 244 this.includeMemberships = include; 245 } 246 247 /** 248 * Returns the NameID mapper class 249 * @return returns the nameid mapper class. 250 */ 251 public String getNameIDMapper() { 252 return nameIDMapper; 253 } 254 255 /** 256 * Sets the NameID Mapper class. 257 * @param nameIDMapper NameID Mapper class. 258 */ 259 public void setNameIDMapper(String nameIDMapper){ 260 this.nameIDMapper = nameIDMapper; 261 } 262 263 /** 264 * Returns SAML attribute namespace. 265 * @return returns SAML attribute namespace. 266 */ 267 public String getSAMLAttributeNamespace() { 268 return attributeNS; 269 } 270 271 /** 272 * Sets SAML attribute namespace. 273 * @param attributeNS SAML attribute namespace. 274 */ 275 public void setSAMLAttributeNamespace(String attributeNS) { 276 this.attributeNS = attributeNS; 277 } 278 279 /** 280 * Returns the list of requested claims 281 * @return the list of requested claims. 282 */ 283 public List getRequestedClaims() { 284 return requestedClaims; 285 } 286 287 /** 288 * Sets the list of requested claims 289 * @param requestedClaims the list of requested claims. 290 */ 291 public void setRequestedClaims(List requestedClaims) { 292 this.requestedClaims = requestedClaims; 293 } 294 295 /** 296 * Returns the DNS claim name. 297 * @return the DNS claim name. 298 */ 299 public String getDNSClaim() { 300 return dnsClaim; 301 } 302 303 /** 304 * Sets the DNS claim name 305 * @param dnsClaim the DNS claim name 306 */ 307 public void setDNSClaim(String dnsClaim) { 308 this.dnsClaim = dnsClaim; 309 } 310 311 /** 312 * Returns the list of signed elements. 313 * @return the list of signed elements. 314 */ 315 public List getSignedElements() { 316 return signedElements; 317 } 318 319 /** 320 * Sets the signed elements 321 * @param signedElements the signed elements. 322 */ 323 public void setSignedElements(List signedElements) { 324 this.signedElements = signedElements; 325 } 326}