use of com.sun.identity.console.federation.SAMLv2AuthContexts in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getSPAuthenticationContexts.
/**
* Returns the object of Auththentication Contexts in SP.
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @return SAMLv2AuthContexts contains SP authContexts values.
* @throws AMConsoleException if unable to retrieve the SP
* Authentication Contexts
*/
public SAMLv2AuthContexts getSPAuthenticationContexts(String realm, String entityName) throws AMConsoleException {
SAMLv2AuthContexts cxt = new SAMLv2AuthContexts();
try {
List tmpList = new ArrayList();
SAML2MetaManager saml2MetaManager = getSAML2MetaManager();
Map map = new HashMap();
BaseConfigType spConfig = saml2MetaManager.getSPSSOConfig(realm, entityName);
if (spConfig != null) {
map = SAML2MetaUtils.getAttributes(spConfig);
} else {
throw new AMConsoleException("invalid.entity.name");
}
List list = (List) map.get(SP_AUTHN_CONTEXT_CLASS_REF_MAPPING);
for (int i = 0; i < list.size(); i++) {
String tmp = (String) list.get(i);
int index = tmp.lastIndexOf("|");
boolean isDefault = false;
String defaultValue = tmp.substring(index + 1);
if (defaultValue.equals("default")) {
isDefault = true;
}
tmp = tmp.substring(0, index);
index = tmp.indexOf("|");
String level = tmp.substring(index + 1);
String name = tmp.substring(0, index);
cxt.put(name, "true", level, isDefault);
}
} catch (SAML2MetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
throw new AMConsoleException(getErrorString(e));
}
return (cxt != null) ? cxt : new SAMLv2AuthContexts();
}
use of com.sun.identity.console.federation.SAMLv2AuthContexts in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getIDPAuthenticationContexts.
/**
* Returns the object of Auththentication Contexts in IDP.
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @return SAMLv2AuthContexts contains IDP authContexts values.
* @throws AMConsoleException if unable to retrieve the IDP
* Authentication Contexts
*/
public SAMLv2AuthContexts getIDPAuthenticationContexts(String realm, String entityName) throws AMConsoleException {
SAMLv2AuthContexts cxt = new SAMLv2AuthContexts();
try {
List tmpList = new ArrayList();
SAML2MetaManager saml2MetaManager = getSAML2MetaManager();
Map map = new HashMap();
BaseConfigType idpConfig = saml2MetaManager.getIDPSSOConfig(realm, entityName);
if (idpConfig != null) {
map = SAML2MetaUtils.getAttributes(idpConfig);
} else {
throw new AMConsoleException("invalid.entity.name");
}
List list = (List) map.get(IDP_AUTHN_CONTEXT_CLASS_REF_MAPPING);
for (int i = 0; i < list.size(); i++) {
String tmp = (String) list.get(i);
int index = tmp.lastIndexOf("|");
boolean isDefault = false;
String defaultValue = tmp.substring(index + 1);
if (defaultValue.equals("default")) {
isDefault = true;
}
tmp = tmp.substring(0, index);
index = tmp.lastIndexOf("|");
String authScheme = tmp.substring(index + 1);
tmp = tmp.substring(0, index);
index = tmp.indexOf("|");
String level = tmp.substring(index + 1);
String name = tmp.substring(0, index);
cxt.put(name, "true", authScheme, level, isDefault);
}
} catch (SAML2MetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
throw new AMConsoleException(getErrorString(e));
}
return (cxt != null) ? cxt : new SAMLv2AuthContexts();
}
Aggregations