DefaultIDPAuthnContextMapper.java revision a688bcbb4bcff5398fdd29b86f83450257dc0df4
/**
* 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: DefaultIDPAuthnContextMapper.java,v 1.9 2008/11/10 22:57:02 veiming Exp $
*
*/
/*
* Portions Copyrighted 2011 ForgeRock AS
*/
/**
* This class is an out of the box default implementation of interface
* <code>IDPAuthnContextMapper</code>.
*/
public class DefaultIDPAuthnContextMapper
implements IDPAuthnContextMapper {
public static SAML2MetaManager metaManager =
/**
* Constructor
*/
public DefaultIDPAuthnContextMapper() {
}
/**
* Returns an <code>IDPAuthnContextInfo</code> object.
*
* @param authnRequest the <code>AuthnRequest</code> from the
* Service Provider
* @param idpEntityID the Entity ID of the Identity Provider
* @param realm the realm to which the Identity Provider belongs
*
* @return an <code>IDPAuthnContextInfo</code> object
* @throws SAML2Exception if an error occurs.
*/
throws SAML2Exception {
"DefaultIDPAuthnContextMapper.getIDPAuthnContextInfo: ";
// Get the ClassRef to AuthnType and Value Map
}
// Get the ClassRef to AuthN Level Map
}
// If one of the Maps above was empty populate them
if (classRefSchemesMap == null) {
classRefSchemesMap = new LinkedHashMap();
}
if (classRefLevelMap == null) {
classRefLevelMap = new LinkedHashMap();
}
}
// Look now for the Authn Class Ref that fulfills the request
if (authnRequest != null) {
}
if (requestedAuthnContext != null) {
{
{
{
break;
}
}
break;
}
}
return null;
}
} else {
}
}
"\nreturned AuthnContextClassRef=" + classRef +
"\nauthTypeAndValues=" + authTypeAndValues +
"\nauthnLevel=" + authnLevel);
}
return info;
}
/**
* Returns <code>AuthnContext</code> that matches the authenticated level.
* @param authLevel user authenticated level
* @param realm the realm to which the Identity Provider belongs
* @param idpEntityID the Entity ID of the Identity Provider
*
* @return <code>AuthnContext</code> object that matches authenticated
* level. Return default AuthnContext if authLevel is <code>null</code>.
* @throws SAML2Exception if an error occurs.
*/
throws SAML2Exception
{
}
if (classRefLevelMap == null) {
classRefLevelMap = new HashMap();
}
}
try {
break;
}
}
} catch (NumberFormatException ne) {
"DefaultIDPAuthnContextMapper.getAuthnContextFromLevel:"
+ " input authLevel is not valid.", ne);
}
}
}
}
}
"DefaultIDPAuthnContext.getClassRefFromLevel: authLevel=" +
", classRefLevelMap=" + classRefLevelMap);
}
return result;
}
/**
* Returns true if the specified AuthnContextClassRef matches a list of
* requested AuthnContextClassRef.
*
* @param requestedACClassRefs a list of requested AuthnContextClassRef's
* @param acClassRef AuthnContextClassRef
* @param comparison the type of comparison
* @param realm the realm to which the Identity Provider belongs
* @param idpEntityID the Entity ID of the Identity Provider
*
* @return true if the specified AuthnContextClassRef matches a list of
* requested AuthnContextClassRef
*/
}
if (acClassRefLevelMap == null) {
acClassRefLevelMap = new HashMap();
}
}
}
boolean isDefault = false;
isDefault = true;
}
if (st.hasMoreTokens()) {
if (st.hasMoreTokens()) {
try {
if (isDefault &&
{
}
} catch (NumberFormatException nfe) {
"DefaultIDPAuthnContextMapper." +
"getACClassRefLevelMap:", nfe);
}
}
} else {
// this is not a level, but a auth scheme def.
}
}
while (st.hasMoreTokens()) {
}
}
}
if (isDefault) {
}
}
}
}
if (!classRefSchemesMap.isEmpty()) {
}
if (!classRefLevelMap.isEmpty()) {
}
if (defaultClassRef != null) {
}
}
}