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;
}
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;
}
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()));
}
}
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;
}
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;
}
Aggregations