Search in sources :

Example 6 with AssertionConsumerServiceElement

use of com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement in project OpenAM by OpenRock.

the class SAMLv2ModelImpl method getAscObject.

/*
     *Creates and returns a new AssertionConsumerServiceElement.
     *
     * @throws AMConsoleException if unable to retrieve.
     */
public AssertionConsumerServiceElement getAscObject() throws AMConsoleException {
    com.sun.identity.saml2.jaxb.metadata.ObjectFactory objFact = new com.sun.identity.saml2.jaxb.metadata.ObjectFactory();
    AssertionConsumerServiceElement acsElem = null;
    try {
        acsElem = objFact.createAssertionConsumerServiceElement();
    } catch (JAXBException e) {
        if (debug.warningEnabled()) {
            debug.warning("SAMLv2ModelImpl.getAscObject:", e);
        }
        throw new AMConsoleException(getErrorString(e));
    }
    return acsElem;
}
Also used : ObjectFactory(com.sun.identity.saml2.jaxb.entityconfig.ObjectFactory) JAXBException(javax.xml.bind.JAXBException) AssertionConsumerServiceElement(com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 7 with AssertionConsumerServiceElement

use of com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement in project OpenAM by OpenRock.

the class SAMLv2SPServicesViewBean method updateWithAssertionServiceVlues.

private List updateWithAssertionServiceVlues() throws ModelControlException {
    List asconsServiceList = new ArrayList();
    int num = 0;
    SAMLv2Model model = (SAMLv2Model) getModel();
    CCActionTable tbl = (CCActionTable) getChild(TBL_ASSERTION_CONSUMER_SERVICE);
    tbl.restoreStateData();
    try {
        num = model.getAssertionConsumerServices(realm, entityName).size();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    for (int i = 0; i < num; i++) {
        tblAssertionConsumerModel.setLocation(i);
        String isDefault = (String) tblAssertionConsumerModel.getValue(TBL_DATA_DEFAULT);
        boolean theValue = Boolean.parseBoolean(isDefault);
        String type = (String) tblAssertionConsumerModel.getValue(TBL_DATA_TYPE);
        String binding = "urn:oasis:names:tc:SAML:2.0:bindings:" + type;
        String location = (String) tblAssertionConsumerModel.getValue(TBL_DATA_LOCATION);
        String index = (String) tblAssertionConsumerModel.getValue(TBL_DATA_INDEX);
        AssertionConsumerServiceElement acsElem = null;
        try {
            acsElem = model.getAscObject();
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
        acsElem.setBinding(binding);
        acsElem.setIsDefault(theValue);
        acsElem.setIndex(Integer.parseInt(index));
        acsElem.setLocation(location);
        asconsServiceList.add(acsElem);
    }
    return asconsServiceList;
}
Also used : ArrayList(java.util.ArrayList) AssertionConsumerServiceElement(com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model)

Example 8 with AssertionConsumerServiceElement

use of com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement in project OpenAM by OpenRock.

the class SAMLv2SPServicesViewBean method populateAssertionConsumer.

private void populateAssertionConsumer(List assertionConServices) {
    tblAssertionConsumerModel.clear();
    SAMLv2Model model = (SAMLv2Model) getModel();
    int numberOfRows = assertionConServices.size();
    for (int i = 0; i < numberOfRows; i++) {
        tblAssertionConsumerModel.appendRow();
        AssertionConsumerServiceElement acsElem = (AssertionConsumerServiceElement) assertionConServices.get(i);
        tblAssertionConsumerModel.setValue(TBL_DATA_DEFAULT, String.valueOf(acsElem.isIsDefault()));
        tblAssertionConsumerModel.setValue(TBL_DATA_TYPE, ((acsElem.getBinding()).substring(37)));
        tblAssertionConsumerModel.setValue(TBL_DATA_LABEL, ((acsElem.getBinding()).substring(37)));
        tblAssertionConsumerModel.setValue(TBL_DATA_LOCATION, acsElem.getLocation());
        tblAssertionConsumerModel.setValue(TBL_DATA_INDEX, Integer.toString(acsElem.getIndex()));
    }
}
Also used : AssertionConsumerServiceElement(com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement) SAMLv2Model(com.sun.identity.console.federation.model.SAMLv2Model)

Example 9 with AssertionConsumerServiceElement

use of com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement in project OpenAM by OpenRock.

the class MetaDataParser method getSPbaseUrl.

public String getSPbaseUrl() {
    try {
        SAML2MetaManager manager = new SAML2MetaManager();
        SPSSODescriptorElement sp = manager.getSPSSODescriptor("/", getSPEntityID());
        List ssoServiceList = sp.getAssertionConsumerService();
        AssertionConsumerServiceElement acs = null;
        for (int i = 0; i < ssoServiceList.size(); i++) {
            acs = (AssertionConsumerServiceElement) ssoServiceList.get(i);
            return acs.getLocation();
        }
        return null;
    } catch (SAML2MetaException ex) {
        Logger.getLogger(MetaDataParser.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}
Also used : SPSSODescriptorElement(com.sun.identity.saml2.jaxb.metadata.SPSSODescriptorElement) AssertionConsumerServiceElement(com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement) List(java.util.List) SAML2MetaManager(com.sun.identity.saml2.meta.SAML2MetaManager) SAML2MetaException(com.sun.identity.saml2.meta.SAML2MetaException)

Example 10 with AssertionConsumerServiceElement

use of com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement in project OpenAM by OpenRock.

the class IDPSSOUtil method getACSurlFromMetaByBinding.

/**
     * Returns the assertion consumer service <code>URL</code> from
     * meta data by binding
     *
     * @param spEntityID      the entity id of the service provider
     * @param realm           the realm name of the identity provider
     * @param desiredBinding  the desired binding
     * @param returnedBinding the binding used to send back
     *                        <code>Response</code>
     * @return the assertion consumer service <code>URL</code>
     * @throws SAML2Exception if the operation is not successful
     */
public static String getACSurlFromMetaByBinding(String spEntityID, String realm, String desiredBinding, StringBuffer returnedBinding) throws SAML2Exception {
    String classMethod = "IDPSSOUtil.getACSurlFromMetaByBinding: ";
    SPSSODescriptorElement spSSODescriptorElement = getSPSSODescriptor(realm, spEntityID, classMethod);
    List acsList = spSSODescriptorElement.getAssertionConsumerService();
    String acsURL = null;
    String binding = null;
    String defaultAcsURL = null;
    String defaultBinding = null;
    String firstAcsURL = null;
    String firstBinding = null;
    AssertionConsumerServiceElement acs = null;
    for (int i = 0; i < acsList.size(); i++) {
        acs = (AssertionConsumerServiceElement) acsList.get(i);
        binding = acs.getBinding();
        if (binding.equals(desiredBinding)) {
            acsURL = acs.getLocation();
            break;
        }
        if (acs.isIsDefault()) {
            defaultAcsURL = acs.getLocation();
            defaultBinding = acs.getBinding();
        }
        if (i == 0) {
            firstAcsURL = acs.getLocation();
            firstBinding = acs.getBinding();
        }
    }
    if (acsURL == null || acsURL.length() == 0) {
        acsURL = defaultAcsURL;
        if (acsURL == null || acsURL.length() == 0) {
            acsURL = firstAcsURL;
            if (acsURL == null || acsURL.length() == 0) {
                acsURL = null;
                SAML2Utils.debug.error(classMethod + "Unable to get valid Assertion " + "Consumer Service URL");
                return null;
            }
            returnedBinding.append(firstBinding);
        } else {
            returnedBinding.append(defaultBinding);
        }
    } else {
        returnedBinding.append(binding);
    }
    return acsURL;
}
Also used : SPSSODescriptorElement(com.sun.identity.saml2.jaxb.metadata.SPSSODescriptorElement) AssertionConsumerServiceElement(com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

AssertionConsumerServiceElement (com.sun.identity.saml2.jaxb.metadata.AssertionConsumerServiceElement)12 List (java.util.List)9 SPSSODescriptorElement (com.sun.identity.saml2.jaxb.metadata.SPSSODescriptorElement)7 ArrayList (java.util.ArrayList)7 Iterator (java.util.Iterator)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)2 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)2 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)2 SubjectConfirmation (com.sun.identity.saml2.assertion.SubjectConfirmation)1 SubjectConfirmationData (com.sun.identity.saml2.assertion.SubjectConfirmationData)1 ObjectFactory (com.sun.identity.saml2.jaxb.entityconfig.ObjectFactory)1 EntityDescriptorElement (com.sun.identity.saml2.jaxb.metadata.EntityDescriptorElement)1 IDPList (com.sun.identity.saml2.protocol.IDPList)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 JAXBException (javax.xml.bind.JAXBException)1