FAMSTSTokenProvider.java revision 4a2f0f0be43dfd4c1b490cbf3cc48b6ba6084b1c
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: FAMSTSTokenProvider.java,v 1.18 2010/01/15 18:54:35 mrudul_uchil Exp $
*
*/
public class FAMSTSTokenProvider implements STSTokenProvider {
//Check
return;
}
return;
}
long tokenLifeSpan =
getTime());
// Bug in WSIT
if("urn:oasis:names:tc:SAML:1.0:cm::sender-vouches".equals(
confirMethod)) {
}
final X509Certificate stsCert =
// Create the KeyInfo for SubjectConfirmation
// Create AssertionID
+ tokenType);
}
//Create SAML Assertion
try {
if(LogUtil.isLogEnabled()) {
data,
null);
}
} catch (FAMSTSException fse) {
"Could not generate SAML11 Assertion", fse);
}
tokenType)){
try {
if(LogUtil.isLogEnabled()) {
data,
null);
}
} catch (FAMSTSException fse) {
"Could not generate SAML2 Assertion", fse);
}
} else {
// TBD : Need to add code for UserName token creation and
// X509 token creation.
"UNSUPPORTED_TOKEN_TYPE");
data,
null);
throw new WSTrustException(
}
}
// Create References
tokenType)){
}
final SecurityTokenReference samlReference =
final RequestedAttachedReference raRef =
final RequestedUnattachedReference ruRef =
}
throw new UnsupportedOperationException("Not supported yet.");
}
throw new UnsupportedOperationException("Not supported yet.");
}
throws WSTrustException {
throw new UnsupportedOperationException("Not supported yet.");
}
try {
if(subjectName == null) {
"Assertion: subject is null");
}
throw new FAMSTSException(
}
if (confirMethod == null){
} else {
}
}
}
}
return token.toDocumentElement();
} catch (SecurityException se) {
" failed in creating SAML11 Token", se);
} catch (SAMLException sle) {
" failed in creating SAML11 Token", sle);
} catch (KeyResolverException ke) {
" failed in creating SAML11 Token", ke);
}
}
try {
if(subjectName == null) {
"Assertion: subject is null");
}
throw new FAMSTSException(
}
if (confirMethod == null) {
} else {
}
}
}
}
return saml2Token.toDocumentElement();
} catch (SecurityException se) {
" failed in creating SAML20 Token", se);
} catch (SAML2Exception s2e) {
" failed in creating SAML20 Token", s2e);
} catch (KeyResolverException ke) {
" failed in creating SAML20 Token", ke);
}
}
attrKey.getLocalPart())){
}
}
}
return null;
}
try {
} catch(XMLSecurityException ex){
"UNABLE_GET_CLIENT_CERT : ", ex);
throw new WSTrustException(
}
}
final DocumentBuilderFactory docFactory =
try{
}catch(ParserConfigurationException ex){
"ERROR_CREATING_DOCFACTORY : ", ex);
throw new WSTrustException(
}
try {
final EncryptedKey encKey =
"ERROR_ENCRYPT_PROOFKEY : ", ex);
throw new WSTrustException(
}
try {
} catch(XMLSecurityException ex) {
"UNABLE_GET_CLIENT_CERT : ", ex);
throw new WSTrustException(
}
}
return keyInfo;
}
/**
* Generates OpenSSO SSOToken by consuming SAML Assertion.
* @param ctx Issued Token Context from WS-Trust Request
* @throws com.sun.xml.ws.api.security.trust.WSTrustException
*/
throws WSTrustException {
}
continue;
}
try {
new STSClientUserToken(famToken);
} catch (FAMSTSException se) {
}
if(assertionE == null) {
throw new WSTrustException(
}
try {
namespace)) {
namespace)) {
}
} catch (SecurityException se) {
}
}
}
}
if(subjectName == null) {
throw new WSTrustException(
}
try {
"FAMSTSTokenProvider.generateSSOToken: " +
}
}
}
} catch (SessionException se) {
"session exception ", se);
} catch (FAMSTSException fe) {
"FAMSTSException ", fe);
} catch (SSOException ssoe) {
"SSOException ", ssoe);
}
}
return;
}
try {
new STSClientUserToken(credential);
continue;
}
"com.sun.identity.wss.security.useHashedPassword",
"true"));
if(!useHashedPassword) {
if(encryptedPassword == null ||
throw new WSTrustException("noEncryptedPassword");
}
} else {
}
throw new WSTrustException("noUserPassword");
}
tokenSpec.setCreateTimeStamp(true);
} catch (FAMSTSException fe) {
"FAMSTSTokenProvider.generateUserNameToken: " +
"FAMSTSException ", fe);
} catch (SSOException se) {
"FAMSTSTokenProvider.generateUserNameToken: " +
"SSOException ", se);
} catch (SecurityException see) {
"FAMSTSTokenProvider.generateUserNameToken: " +
"SSOException ", see);
}
}
}
}
}
return null;
}
return null;
}
}
}
return null;
}
} else if(
} else if(
} else {
}
}
}