Search in sources :

Example 1 with RequestAuthnContext

use of com.sun.identity.federation.message.common.RequestAuthnContext in project OpenAM by OpenRock.

the class FSLoginHelper method getAuthnReq.

private FSAuthnRequest getAuthnReq(Map headers, String LRURL, boolean federate) throws FSLoginHelperException {
    FSAuthnRequest authnRequest = null;
    RequestAuthnContext authnContext = null;
    List respondWithArray = new ArrayList();
    List authnContextProfileClassRefArray = new ArrayList();
    List authnContextStatementRefArray = new ArrayList();
    try {
        if (isLECPProfile(headers)) {
            protocolProfile = IFSConstants.SSO_PROF_LECP;
        } else if (isWMLProfile(headers)) {
            protocolProfile = IFSConstants.SSO_PROF_WML_POST;
        }
        if (FSUtils.debug.messageEnabled()) {
            FSUtils.debug.message("FSLoginHelper::getAuthnReq():" + "Federation profile is:" + protocolProfile);
        }
        if (respondWithString != null) {
            StringTokenizer st = new StringTokenizer(respondWithString, ",");
            while (st.hasMoreTokens()) {
                String tmpString = (String) st.nextToken();
                respondWithArray.add(tmpString);
            }
        } else {
            respondWithArray = null;
        }
        authnContextProfileClassRefArray.add(authContextString);
        authnContextStatementRefArray = null;
        // this should be configurable
        String authnContextComparison = IFSConstants.MINIMUM;
        authnContext = new RequestAuthnContext(authnContextProfileClassRefArray, authnContextStatementRefArray, authnContextComparison);
        String nameIDPolicyForReal;
        if (!federate && nameIDPolicy.equals(IFSConstants.NAME_ID_POLICY_FEDERATED)) {
            nameIDPolicyForReal = IFSConstants.NAME_ID_POLICY_NONE;
        } else {
            nameIDPolicyForReal = nameIDPolicy;
        }
        if (anonymousOnetime != null && anonymousOnetime.equals("true")) {
            nameIDPolicyForReal = IFSConstants.NAME_ID_POLICY_ONETIME;
            federate = true;
        }
        authnRequest = new FSAuthnRequest(null, respondWithArray, hostEntityID, forceAuthn, isPassive, federate, nameIDPolicyForReal, protocolProfile, authnContext, LRURL, IFSConstants.MINIMUM);
    } catch (Exception ex) {
        FSUtils.debug.error("FSLoginHelper.getAuthnReq():Error during procesing:", ex);
        throw new FSLoginHelperException("FSLoginHelper.getAuthnReq() In Exception " + ex.getMessage());
    }
    return authnRequest;
}
Also used : StringTokenizer(java.util.StringTokenizer) RequestAuthnContext(com.sun.identity.federation.message.common.RequestAuthnContext) FSAuthnRequest(com.sun.identity.federation.message.FSAuthnRequest) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) FSIDPList(com.sun.identity.federation.message.FSIDPList) COTException(com.sun.identity.cot.COTException) IDFFMetaException(com.sun.identity.federation.meta.IDFFMetaException)

Aggregations

COTException (com.sun.identity.cot.COTException)1 FSAuthnRequest (com.sun.identity.federation.message.FSAuthnRequest)1 FSIDPList (com.sun.identity.federation.message.FSIDPList)1 RequestAuthnContext (com.sun.identity.federation.message.common.RequestAuthnContext)1 IDFFMetaException (com.sun.identity.federation.meta.IDFFMetaException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 StringTokenizer (java.util.StringTokenizer)1