/*
* 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: FSAssertionManagerClient.java,v 1.8 2008/08/19 19:11:06 veiming Exp $
*
* Portions Copyrighted 2015 ForgeRock AS.
*/
/**
* The class <code>FSAssertionManagerClient</code> is a <code>final</code> class
* that provides interfaces to create, get and destroy <code>Assertion</code>s.
* <p>
* The class provides mechanisms to manage the <code>Assertion</code>s either
* locally (i.e., within the same JVM process) or remotely on another instance
* of OpenAM. The default constructor will manage the <code>
* Assertion</code>s locally if it detects SAML web services running locally,
* else will use one of the configured OpenAM. The constructor which
* accepts an <code>URL</code> will always use the URL to manage the assertions.
* <p>
* Having obtained an instance of <code>FSAssertionManagerClient</code>,
* <code>AssertionArtifact</code>, and to obtain decision from an
* <code>Query</code>.
*
*/
public final class FSAssertionManagerClient {
// Service name in naming
// Flag to determine if FSAssertionManager is local or remote
private static boolean checkedForLocal;
private static boolean isLocal;
private boolean useLocal;
// Remote JAX-RPC server for objects that use default constructor
// If local pointer to AssertionManager instance
// JAX-RPC remote stub
/**
* Returns an instance of <code>AssertionManagerClient</code>.
*
* @param metaAlias hosted provider's meta alias.
* @throws FSException
*/
{
if (!checkedForLocal) {
try {
// Construct the URL for local server
if (FSAssertionManagerImpl.isLocal) {
isLocal = true;
}
checkedForLocal = true;
} catch (Exception e) {
checkedForLocal = true;
"AssertionManagerClient()Exception", e);
}
throw (new FSException(e.getMessage()));
}
}
if (isLocal) {
useLocal = true;
} else {
// Use the remoteStub if set
stub = remoteStub;
}
}
/**
* Returns an instance of <code>FSAssertionManagerClient</code>
* that will use the provided <code>URL</code> for the management
* of assertions.
*
* @param metaAlias hosted provider's meta alias.
* @param url the <code>FSAssertionManager</code> service URL that
* will be used to create, get and delete <code>Assertion</code>s
* @throws FSException
*/
throws FSException {
try {
// Construct the JAX-RPC stub and set the URL endpoint
} catch (Exception e) {
"FSAssertionManagerClient() Exception", e);
}
throw (new FSException(e.getMessage()));
}
}
// Private method to get the service endpoint URL
throws Exception
{
// Obtain the URL for the service endpoint
}
// Obtaining the stub for JAX-RPC and setting the endpoint URL
return new SOAPClient(urls);
}
/**
* Returns assertion associated with the <code>AssertionArtifact</code>.
* @param artifact An <code>AssertionArtifact</code>.
* @param destID The destination site requesting the assertion using
* the artifact. This String is compared with the destID that
* the artifact is created for originally.
* @return The Assertion referenced to by artifact.
* @exception FSException If an error occurred during the process, or no
* assertion maps to the input artifact.
*/
throws FSException
{
if (useLocal) {
}
try {
}
} else {
}
}
.getDocumentElement()));
} catch (RemoteException re) {
}
} catch (FSRemoteException re) {
}
} catch (SAMLException re) {
}
}
}
}
/**
* Returns the destination id the artifact is created for.
* @param artifact <code>AssertionArtifact</code> object
* @return destination id
* @exception FSException if error occurred.
*/
throws FSException
{
if (useLocal) {
}
try {
"AMC:getDestIdForArtifact(" + artifact +
"): Server returned NULL");
}
}
return providerId;
} catch (RemoteException re) {
re);
}
} catch (FSRemoteException re) {
re);
}
re);
}
}
}
/**
* Checks if the user exists.
* @param userDN user ID
* @return <code>true</code> if the user exists; <code>false</code>
* otherwise.
* @exception FSException if error occurred.
*/
throws FSException
{
try {
null);
+ " returned " + ret);
}
return ret.booleanValue();
} catch (RemoteException re) {
}
} catch (FSRemoteException re) {
}
}
}
}
throws FSException
{
try {
"): Server returned NULL");
}
} else {
status );
}
}
}
}
} catch (RemoteException re) {
}
} catch (FSRemoteException re) {
}
} catch (SAMLException re) {
}
}
}
return null;
}
}