use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getExtendedServiceProviderAttributes.
/**
* Returns a map with extended service provider attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with extended attribute values of Service Provider.
* @throws AMConsoleException if unable to retrieve the Service Provider
* attrubutes based on the realm and entityName passed.
*/
public Map getExtendedServiceProviderAttributes(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "SP-Extended" };
logEvent("ATTEMPT_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
Map map = null;
SPSSOConfigElement spssoConfig = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
spssoConfig = samlManager.getSPSSOConfig(realm, entityName);
if (spssoConfig != null) {
BaseConfigType baseConfig = (BaseConfigType) spssoConfig;
map = SAML2MetaUtils.getAttributes(baseConfig);
}
logEvent("SUCCEED_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getExtendedServiceProviderAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "SP-Extended", strError };
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (map != null) ? map : Collections.EMPTY_MAP;
}
use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getExtendedAttrQueryAttributes.
/**
* Returns a map with extended AttrQuery attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with extended AttrQuery values.
* @throws AMConsoleException if unable to retrieve ext AttrQuery
* attributes based on the realm and entityName passed.
*/
public Map getExtendedAttrQueryAttributes(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AttrQuery-Ext" };
logEvent("ATTEMPT_GET_ATTR_QUERY_ATTR_VALUES", params);
Map map = null;
AttributeQueryConfigElement attrQueryConfig = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
attrQueryConfig = samlManager.getAttributeQueryConfig(realm, entityName);
if (attrQueryConfig != null) {
BaseConfigType baseConfig = (BaseConfigType) attrQueryConfig;
map = SAML2MetaUtils.getAttributes(baseConfig);
}
logEvent("SUCCEED_GET_ATTR_QUERY_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getExtendedAttrQueryAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AttrQuery-Ext", strError };
logEvent("FEDERATION_EXCEPTION_GET_ATTR_QUERY_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (map != null) ? map : Collections.EMPTY_MAP;
}
use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getExtendedAffiliationyAttributes.
/**
* Returns a map with extended Affiliation attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with extended Affiliation values.
* @throws AMConsoleException if unable to retrieve ext Affiliation
* attributes based on the realm and entityName passed.
*/
public Map getExtendedAffiliationyAttributes(String realm, String entityName) throws AMConsoleException {
;
String[] params = { realm, entityName, "SAMLv2", "Affiliation-Ext" };
logEvent("ATTEMPT_GET_AFFILIATION_ATTR_VALUES", params);
Map map = null;
AffiliationConfigElement atffilConfig = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
atffilConfig = samlManager.getAffiliationConfig(realm, entityName);
if (atffilConfig != null) {
BaseConfigType baseConfig = (BaseConfigType) atffilConfig;
map = SAML2MetaUtils.getAttributes(baseConfig);
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
}
String metalias = baseConfig.getMetaAlias();
List list = new ArrayList();
list.add(metalias);
map.put("metaAlias", list);
}
logEvent("SUCCEED_GET_AFFILIATION_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getExtendedAffiliationyAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "Affiliation-Ext", strError };
logEvent("FEDERATION_EXCEPTION_GET_AFFILIATION_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (map != null) ? map : Collections.EMPTY_MAP;
}
use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class SAMLv2ModelImpl method getExtendedAuthnAuthorityAttributes.
/**
* Returns a map with extended AuthnAuthority attributes and values.
*
* @param realm to which the entity belongs.
* @param entityName is the entity id.
* @return Map with extended AuthnAuthority values.
* @throws AMConsoleException if unable to retrieve ext AuthnAuthority
* attributes based on the realm and entityName passed.
*/
public Map getExtendedAuthnAuthorityAttributes(String realm, String entityName) throws AMConsoleException {
String[] params = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext" };
logEvent("ATTEMPT_GET_AUTHN_AUTH_ATTR_VALUES", params);
Map map = null;
AuthnAuthorityConfigElement authnAuthorityConfig = null;
try {
SAML2MetaManager samlManager = getSAML2MetaManager();
authnAuthorityConfig = samlManager.getAuthnAuthorityConfig(realm, entityName);
if (authnAuthorityConfig != null) {
BaseConfigType baseConfig = (BaseConfigType) authnAuthorityConfig;
map = SAML2MetaUtils.getAttributes(baseConfig);
}
logEvent("SUCCEED_GET_AUTHN_AUTH_ATTR_VALUES", params);
} catch (SAML2MetaException e) {
debug.warning("SAMLv2ModelImpl.getExtendedAuthnAuthorityAttributes:", e);
String strError = getErrorString(e);
String[] paramsEx = { realm, entityName, "SAMLv2", "AuthnAuthority-Ext", strError };
logEvent("FEDERATION_EXCEPTION_GET_AUTHN_AUTH_ATTR_VALUES", paramsEx);
throw new AMConsoleException(strError);
}
return (map != null) ? map : Collections.EMPTY_MAP;
}
use of com.sun.identity.saml2.jaxb.entityconfig.BaseConfigType in project OpenAM by OpenRock.
the class TaskModelImpl method getConfigureGoogleAppsURLs.
public Map getConfigureGoogleAppsURLs(String realm, String entityId) throws AMConsoleException {
Map map = new HashMap();
IDPSSODescriptorElement idpssoDescriptor = null;
try {
SAML2MetaManager samlManager = new SAML2MetaManager();
idpssoDescriptor = samlManager.getIDPSSODescriptor(realm, entityId);
String signinPageURL = null;
if (idpssoDescriptor != null) {
List signonList = idpssoDescriptor.getSingleSignOnService();
for (int i = 0; i < signonList.size(); i++) {
SingleSignOnServiceElement signElem = (SingleSignOnServiceElement) signonList.get(i);
String tmp = signElem.getBinding();
if (tmp.contains("HTTP-Redirect")) {
signinPageURL = signElem.getLocation();
map.put("SigninPageURL", returnEmptySetIfValueIsNull(signinPageURL));
}
}
}
URL aURL = new URL(signinPageURL);
String signoutPageURL = null;
String protocol = aURL.getProtocol();
String host = aURL.getHost();
int port = aURL.getPort();
if (port == -1) {
port = (aURL.getProtocol().equals("https")) ? 443 : 80;
}
String deploymentURI = SystemPropertiesManager.get(Constants.AM_SERVICES_DEPLOYMENT_DESCRIPTOR);
String url = protocol + "://" + host + ":" + port + deploymentURI;
signoutPageURL = url + "/UI/Logout?goto=" + url;
map.put("SignoutPageURL", returnEmptySetIfValueIsNull(signoutPageURL));
map.put("ChangePasswordURL", returnEmptySetIfValueIsNull(url + "/idm/EndUser"));
// get pubkey
Map extValueMap = new HashMap();
IDPSSOConfigElement idpssoConfig = samlManager.getIDPSSOConfig(realm, entityId);
if (idpssoConfig != null) {
BaseConfigType baseConfig = (BaseConfigType) idpssoConfig;
extValueMap = SAML2MetaUtils.getAttributes(baseConfig);
}
List aList = (List) extValueMap.get("signingCertAlias");
String signingCertAlias = null;
if (aList != null) {
signingCertAlias = (String) aList.get(0);
}
String publickey = SAML2MetaSecurityUtils.buildX509Certificate(signingCertAlias);
String str = "-----BEGIN CERTIFICATE-----\n" + publickey + "-----END CERTIFICATE-----\n";
map.put("PubKey", returnEmptySetIfValueIsNull(str));
} catch (SAML2MetaException ex) {
throw new AMConsoleException(ex.getMessage());
} catch (MalformedURLException ex) {
throw new AMConsoleException(ex.getMessage());
}
return map;
}
Aggregations