IDFFModelImpl.java revision 4a2f0f0be43dfd4c1b490cbf3cc48b6ba6084b1c
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: IDFFModelImpl.java,v 1.9 2009/11/10 01:19:49 exu Exp $
*
*/
public class IDFFModelImpl
extends EntityModelImpl
implements IDFFModel {
private IDFFMetaManager metaManager;
static {
}
static {
}
static {
}
static {
}
static {
}
// BOTH idp AND SP extended metadata
static {
}
// IDP extend meta attribute ONLY IDP
static {
}
// SP extend meta attribute.. ONLY SP
static {
}
/**
* Creates a simple model using default resource bundle.
*
* @param req HTTP Servlet Request
* @param map of user information
*/
}
/**
* Returns provider-affiliate common attribute values.
* @param realm the realm in which the entity resides.
* @param entityName Name of Entity Descriptor.
* @return provider-affiliate common attribute values.
* @throws IDFFMetaException if attribute values cannot be obtained.
*/
throws AMConsoleException {
try {
realm, entityName);
desc.getValidUntil()));
desc.getCacheDuration()));
} catch (IDFFMetaException e) {
};
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(getErrorString(e));
}
return values;
}
/**
* Modifies entity descriptor profile.
*
* @param realm the realm in which the entity resides.
* @param entityName Name of entity descriptor.
* @param map Map of attribute type to a Map of attribute name to values.
* @throws AMConsoleException if profile cannot be modified.
*/
throws AMConsoleException {
try {
realm, entityName);
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
*
* @param realm where the entity exists.
* @param entityName of entity descriptor.
*/
throws AMConsoleException {
try {
// common attributes
//communication URLs
// communication profiles
// get signing key size and algorithm
true); //isIDP
} else {
}
} catch (IDFFMetaException e) {
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(strError);
}
return map;
}
/**
*
* @param realm where the entity exists.
* @param entityName name of entity descriptor.
*/
throws AMConsoleException {
try {
// common attributes
//communication URLs
// communication profiles
// only for Service Provider
com.sun.identity.liberty.ws.meta.jaxb.SPDescriptorType.AssertionConsumerServiceURLType assertionType =
(com.sun.identity.liberty.ws.meta.jaxb.SPDescriptorType.AssertionConsumerServiceURLType) ((List) pDesc.getAssertionConsumerServiceURL()).get(0);
if (assertionType != null) {
} else {
}
// get signing key size and algorithm
false); //isIDP
} else {
}
} catch (IDFFMetaException e) {
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(strError);
}
return map;
}
/**
* Returns attributes values in extended metadata.
*
* @param realm where the entity exists.
* @param entityName Name of Entity Descriptor.
* @param location Location of provider such as Hosted or Remote.
* @return attributes values of provider.
*/
public Map getIDPEntityConfig(
try {
} else {
}
}
}
}
} catch (IDFFMetaException e) {
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(getErrorString(e));
}
return tmpMap;
}
/**
* Returns attributes values in extended metadata.
*
* @param realm where the entity exists.
* @param entityName Name of Entity Descriptor.
* @param location Location of provider such as Hosted or Remote.
* @return attributes values of provider.
*/
public Map getSPEntityConfig(
try {
} else {
}
if (!supportedSSOProfileList.isEmpty()) {
}
} else {
}
}
}
}
} catch (IDFFMetaException e) {
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
logEvent("FEDERATION_EXCEPTION_GET_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(getErrorString(e));
}
return tmpMap;
}
public void updateEntitySPDescriptor(
boolean ishosted) throws AMConsoleException {
try {
//save key and encryption details if present for hosted
if (ishosted == true) {
String alg = (algorithm == null || algorithm.length() == 0) ? "http://www.w3.org/2001/04/xmlenc#aes128-cbc" : algorithm;
}
realm, entityName);
//Protocol Support Enumeration
//communication URLs
// communication profiles
for (int i = 0; i < size; i++) {
}
}
for (int i = 0; i < size; i++) {
}
}
for (int i = 0; i < size; i++) {
}
}
// only for sp
com.sun.identity.liberty.ws.meta.jaxb.SPDescriptorType.AssertionConsumerServiceURLType assertionType =
assertionType.setIsDefault(true);
} else {
assertionType.setIsDefault(false);
}
pDesc.setAuthnRequestsSigned(true);
} else {
pDesc.setAuthnRequestsSigned(false);
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(strError);
} catch (JAXBException e) {
throw new AMConsoleException(strError);
}
}
public void updateEntityIDPDescriptor(
boolean ishosted) throws AMConsoleException {
try {
//save key and encryption details if present for hosted
if (ishosted == true) {
String alg = (algorithm == null || algorithm.length() == 0) ? "http://www.w3.org/2001/04/xmlenc#aes128-cbc" : algorithm;
}
realm, entityName);
//Protocol Support Enumeration
//communication URLs
// communication profiles
for (int i = 0; i < size; i++) {
}
}
for (int i = 0; i < size; i++) {
}
}
for (int i = 0; i < size; i++) {
}
}
for (int i = 0; i < size; i++) {
federationProfileList.get(i));
}
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(strError);
}
}
private void updateAttrInConfig(
}
}
}
/**
* Modifies a identity provider's extended metadata.
*
* @param entityName name of Entity Descriptor.
* @param realm where entity exists.
* @param attrValues Map of attribute name to set of values.
* @throws AMConsoleException if provider cannot be modified.
* @throws JAXBException if provider cannot be retrieved.
*/
public void updateIDPEntityConfig(
try {
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
if (idpDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
}
//saves the attributes by passing the new entityConfig object
} catch (IDFFMetaException e) {
throw new AMConsoleException(strError);
} catch (JAXBException e) {
throw new AMConsoleException(strError);
}
}
/**
* Modifies a service provider's extended metadata.
*
* @param realm where entity exists.
* @param entityName name of Entity Descriptor.
* @param attrValues Map of attribute name to set of values.
* @throws AMConsoleException if provider cannot be modified.
* @throws JAXBException if provider cannot be retrieved.
*/
public void updateSPEntityConfig(
try {
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
if (spDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
// update sp entity config
//handle supported sso profile
for (int i = 0; i < size; i++) {
}
}
}
//saves the attributes by passing the new entityConfig object
} catch (IDFFMetaException e) {
throw new AMConsoleException(strError);
} catch (JAXBException e) {
throw new AMConsoleException(strError);
}
}
/**
* update IDP Authentication Contexts
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @param cxt IDFFAuthContexts object contains IDP
* Authentication Contexts values
*/
public void updateIDPAuthenticationContexts(
"IDP-updateIDPAuthenticationContexts"
};
try {
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
if (idpDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
list);
}
//saves the attributes by passing the new entityConfig object
} catch (IDFFMetaException e) {
{realm,
"IDFF",
"IDP-updateIDPAuthenticationContexts",
};
throw new AMConsoleException(strError);
}
return;
}
/**
* update SP Authentication Contexts
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @param cxt IDFFAuthContexts object contains SP
* Authentication Contexts values
*/
public void updateSPAuthenticationContexts(
"IDFF",
"SP-updateSPAuthenticationContexts"
};
try {
if (entityConfig == null) {
throw new AMConsoleException("invalid.entity.name");
}
if (spDecConfigElement == null) {
throw new AMConsoleException("invalid.config.element");
} else {
// update sp entity config
list);
}
//saves the attributes by passing the new entityConfig object
} catch (IDFFMetaException e) {
{realm,
"IDFF",
"SP-updateSPAuthenticationContexts",
};
throw new AMConsoleException(strError);
}
return;
}
private void updateAttrInConfig(
}
}
}
throws JAXBException {
}
return bctype;
}
/**
* Updates the BaseConfigElement.
*
* @param baseConfig is the BaseConfigType passed.
* @param role the role of entity.
* @throws AMConsoleException if update of baseConfig object fails.
*/
private void updateAttrInConfig(
}
}
}
}
}
/**
* Returns the object of Auththentication Contexts in IDP.
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @return attributes values of provider.
*/
try {
} else {
throw new AMConsoleException("invalid.entity.name");
}
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
throw new AMConsoleException(getErrorString(e));
}
}
return str;
}
/**
* Returns the object of Auththentication Contexts in SP.
*
* @param realm Realm of Entity
* @param entityName Name of Entity Descriptor.
* @return attributes values of provider.
*/
try {
} else {
throw new AMConsoleException("invalid.entity.name");
}
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (AMConsoleException e) {
throw new AMConsoleException(getErrorString(e));
}
}
public void createEntityConfig(
try {
// Check whether the entity id existed in the DS
if (entityDesc == null) {
throw new AMConsoleException("invalid.entity.name");
}
if (entityConfig == null) {
// add to entityConfig
entityConfig.setHosted(false);
} else {
entityConfig.setHosted(true);
}
}
// create entity config and add the attribute
// Decide which role EntityDescriptorElement includes
// It could have one sp and one idp.
}
}
}
}
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (JAXBException e) {
throw new AMConsoleException(getErrorString(e));
}
}
public Map getAllSPExtendedMetaMap() {
return map;
}
public Map getAllIDPExtendedMetaMap() {
return map;
}
protected IDFFMetaManager getIDFFMetaManager()
throws IDFFMetaException {
if (metaManager == null) {
}
return metaManager;
}
/**
* Returns true if entity descriptor is an affiliate.
*
* @param entityName of entity descriptor.
* @return true if entity descriptor is an affiliate.
* @throws AMConsoleException if entity cannot be retrieved.
*/
throws AMConsoleException {
boolean isAffiliate = false;
try {
isAffiliate = true;
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
}
return isAffiliate;
}
/**
* Returns affiliate profile attribute values.
*
* @param realm the realm in which the entity resides.
* @param entityName name of Entity Descriptor.
* @return affiliate profile attribute values.
* @throws AMConsoleException if attribute values cannot be obtained.
*/
try {
if (affiliationConfig != null) {
} else {
}
} else {
}
}
} else {
}
logEvent("SUCCEED_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES",
params);
} catch (IDFFMetaException e) {
logEvent("FEDERATION_EXCEPTION_GET_AFFILIATE_ENTITY_DESCRIPTOR_ATTR_VALUES",
paramsEx);
throw new AMConsoleException(strError);
}
}
/**
* Modifies affiliate profile.
*
* @param realm the realm in which the entity resides.
* @param entityName Name of entity descriptor.
* @param members Set of affiliate members
* @throws AMConsoleException if profile cannot be modified.
*/
public void updateAffiliateProfile(
try {
//TBD : common attributes which may be added here later
/* ATTR_AFFILIATE_VALID_UNTIL,
* ATTR_AFFILIATE_CACHE_DURATION
* ATTR_ENCRYPTION_KEY_SIZE
* ATTR_AFFILIATE_ENCRYPTION_KEY_ALGORITHM
* ATTR_AFFILIATE_ENCRYPTION_CERT_ALIAS
* ATTR_AFFILIATE_SIGNING_CERT_ALIAS
*/
// add affilliate members
}
} catch (IDFFMetaException e) {
logEvent("FEDERATION_EXCEPTION_MODIFY_AFFILIATE_ENTITY_DESCRIPTOR",
paramsEx);
throw new AMConsoleException(strError);
}
}
/**
* Returns a <code>Set</code> of entity descriptor names.
*
* @param realm the realm in which the entity resides.
* @return the IDFF entity descriptor
* @throws AMConsoleException
*/
throws AMConsoleException {
try {
} catch (IDFFMetaException e) {
throw new AMConsoleException(e.getMessage());
}
}
/**
* @return a Set of all the idff Affiliate entities.
*/
throws AMConsoleException {
try {
}
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(e.getMessage());
}
}
/**
* Returns a Set of all the affiliate members
*
* @param realm the realm in which the entity resides.
* @param entityName name of the Entity Descriptor.
* @throws AMConsoleException if values cannot be obtained.
*/
throws AMConsoleException {
try {
} catch (IDFFMetaException e) {
throw new AMConsoleException(e.getMessage());
}
}
}
}
return val;
}
}