ImportEntityModelImpl.java revision 4a2f0f0be43dfd4c1b490cbf3cc48b6ba6084b1c
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 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: ImportEntityModelImpl.java,v 1.11 2009/11/10 01:19:49 exu Exp $
*
*/
/**
* This class provides import entity provider related functionality. Currently
* the supported types are SAMLv2, IDFF, and WSFederation.
*/
public class ImportEntityModelImpl extends AMModelBase
implements ImportEntityModel
{
private static final String SAML2_PROTOCOL =
"urn:oasis:names:tc:SAML:2.0:metadata";
private String standardMetaData;
private String extendedMetaData;
}
/**
* Import one of the following entity types: SAMLv2, IDFF, or WSFed. The
* parameters are the file names containing the standard and
* extended metadata. The standard is required, while the extended is
* optional.
*
* @param requestData is a Map containing the name of the standard meta
* data file name, and the name of the extended meta data file name.
*
* @throws AMConsoleException if unable to process this request.
*/
throws AMConsoleException
{
try {
// standardFile is the name of the file containing the metada. This
// is a required parameter. If we don't find it in the request throw
// an exception.
if (standardFile == null) {
throw new AMConsoleException("missing.metadata");
}
// try loading the extended metadata, which is optional
// the protocols defined in the standard and extended metadata
// must be the same.
throw new AMConsoleException("protocol.mismatch");
}
}
// the realm is used by the createXXX commands for storing the entity
}
} else {
}
} catch (WorkflowException ex) {
}
}
private void createSAMLv2Entity() throws AMConsoleException {
try {
if (extendedMetaData != null) {
// get the realm from the extended meta and use
// for import
bConfig.getMetaAlias());
}
}
}
if (standardMetaData != null) {
}
}
} catch (SAML2MetaException e) {
throw new AMConsoleException(e.getMessage());
}
}
private EntityConfigElement getEntityConfigElement()
throws SAML2MetaException, AMConsoleException
{
try {
return (obj instanceof EntityConfigElement) ?
} catch (JAXBException e) {
throw new AMConsoleException(e.getMessage());
} catch (IllegalArgumentException e) {
throw new AMConsoleException(e.getMessage());
}
}
private void importWSFedMetaData()
{
try {
obj = ((com.sun.identity.wsfederation.jaxb.wsfederation.FederationMetadataElement)obj).getAny().get(0);
}
// TBD
//Document doc = XMLUtils.toDOMDocument(standardMetadata, debug);
// WSFederationMetaSecurityUtils.verifySignature(doc);
(new WSFederationMetaManager()).
}
} catch (JAXBException e) {
throw new AMConsoleException(e.getMessage());
} catch (IllegalArgumentException e) {
throw new AMConsoleException(e.getMessage());
}
}
throws SAML2MetaException, AMConsoleException
{
try {
if (obj instanceof EntityDescriptorElement) {
}
} catch (JAXBException e) {
throw new AMConsoleException(e.getMessage());
} catch (IllegalArgumentException e) {
throw new AMConsoleException(e.getMessage());
}
}
private void createIDFFEntity() throws AMConsoleException {
try {
if (extendedMetaData != null) {
} else {
spConfig.getMetaAlias());
}
}
}
}
}
} catch (IDFFMetaException e) {
throw new AMConsoleException(e.getMessage());
}
}
throws IDFFMetaException, AMConsoleException
{
if (standardMetaData == null) {
if (debug.warningEnabled()) {
"metaData value was null, skipping import");
}
return;
}
try {
if (obj instanceof
obj;
//TODO: signature
//SAML2MetaSecurityUtils.verifySignature(doc);
//
}
} catch (JAXBException e) {
throw new AMConsoleException(e.getMessage());
} catch (IllegalArgumentException e) {
throw new AMConsoleException(e.getMessage());
}
}
private void createWSFedEntity() throws AMConsoleException {
try {
if (extendedMetaData != null) {
/*
* see note at the end of this class for how we decide
* the realm value
*/
bConfig.getMetaAlias());
}
}
}
if (standardMetaData != null) {
}
}
} catch (WSFederationMetaException e) {
throw new AMConsoleException(e);
}
}
{
try {
return (obj instanceof
null;
} catch (JAXBException e) {
throw new AMConsoleException(e);
} catch (IllegalArgumentException e) {
throw new AMConsoleException(e);
}
}
try {
return (obj instanceof
} catch (JAXBException e) {
throw new AMConsoleException(e.getMessage());
} catch (IllegalArgumentException e) {
throw new AMConsoleException(e.getMessage());
}
}
// returns the type provider defined by the meta data.
}
return protocol;
}
}