/**
* 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: FSSOAPService.java,v 1.4 2008/11/10 22:56:58 veiming Exp $
*
*/
/**
* Utils to handle SOAP profiles.
*/
public class FSSOAPService {
static {
try {
}
try {
} catch(SOAPException e) {
}
};
/* do nothing constructor */
private FSSOAPService() {
}
/*
* Binds the passed object xml string to SOAP message.
* The SOAP Message will then be sent across to the remote
* provider for processing.
* @return SOAPMessage constructed from the xml string
*/
try {
"\n--------------------");
}
bop.toByteArray()));
} catch(Exception e ) {
return null;
}
return msg;
}
/*
* Sends the passed SOAPMessage to the SOAPEndpoint URL
* that is passed.
* @param msg the <code>SOAPMessage</code> to be sent
* @param soapEndPoint the SOAPEndpoint URL of remote provider
* @return SOAPMessage response message from remote provider
* @exception IOException, SOAPException if error occurrs
*/
) throws IOException, SOAPException
{
try {
if (soapEndPoint == null) {
data);
return null;
}
// Send the message to the provider using the connection.
}
return null;
}
// check the SOAP message for any SOAP related errors
// before passing control to SAML processor
output = new ByteArrayOutputStream();
}
return reply;
} catch(Exception e){
return null;
}
}
/*
* Method to send the passed SOAPMessage to the SOAPEndpoint URL
* that is passed. The SOAP Message will then be sent across to the remote
* provider in order to perform federation termination.
* @param msg the <code>FSFederationTerminationNotification</code>
* SOAPMesage to be sent
* @param soapEndPoint the SOAPEndpoint URL of remote provider
* @return boolean true if successful else false
*/
public boolean sendTerminationMessage(
{
try {
if(soapEndPoint == null) {
data);
return false;
}
// Send the message to the provider using the connection.
}
return true;
} catch(Exception e){
}
return false;
}
}
/*
* Parses the SOAPMessage and return the Element
* @param message the <code>SOAPMessage</code> to be parsed
*/
// first check if there was any soap error during verifyHost()
try {
// check the SOAP message for any SOAP
// related errros before passing control to SAM processor
bop = new ByteArrayOutputStream();
"Local name of the SOAPElement in the" +
" SOAPMessage passed seems to be missing");
return null;
}
{
"FSSOAPService.parseSOAPMessage: Could not" +
"parse SOAPMessage, either root element is not Envelope" +
" or invalid name space");
return null;
}
if (blength <=0 ) {
"does not have body");
return null;
}
boolean found = false;
for (int i = 0; i < blength; i++) {
continue;
}
found = true;
break; // found the message body
}
}
if (!found) {
"does not have body1");
return null;
}
//Is soap-env:Fault
if (length > 1) {
return null;
}
if (length != 0 ) {
return null;
}
" parseSOAPMessage soap-env:Fault found in the " +
"SOAPMessage");
}
}
}
try {
//Is samlp:Request
}
//Is samlp:Response
}
//Is lib:AuthnResponseEnvelope
}
//Is lib:AuthnRequest
}
//Is lib:RegisterNameIdentifierRequest
"RegisterNameIdentifierRequest");
}
//Is lib:RegisterNameIdentifierResponse
"RegisterNameIdentifierResponse");
}
//Is lib:FederationTerminationNotification
"FederationTerminationNotification");
}
//Is lib:LogoutRequest
}
//Is lib:LogoutResponse
}
//Is lib:NameIdentifierMappingRequest
"NameIdentifierMappingRequest");
}
//Is lib:NameIdentifierMappingResponse
"NameIdentifierMappingResponse");
}
"FSSOAPService.parseMessage:Invalid message type.");
} catch (FSException e) {
+ "Couldn't object protocol message element.");
}
}
return null;
} catch(Exception e){
return null;
}
}
throws FSException
{
if (length > 1) {
}
if (length != 0 ) {
}
return null;
}
throws FSException
{
if (length == 0) {
}
if (length > 1) {
}
if (length != 0 ) {
}
return null;
}
/*
* Sends a synchronous SOAPMessage to remote provider.
* @param response the http response object
* @param msg the <code>SOAPMessage</code> to be sent
* @param partnerDecriptor the remote provider meta descriptor
* @param needAuthn determines forced authn
* @return <code>SOAPMessage</code> corresponding to liberty
* @exception IOException, SOAPException if error occurrs
*/
boolean needAuthn
) throws IOException, SOAPException
{
response, partnerDecriptor, false);
"createSOAPReceiverURL Error!");
data);
return null;
}
// Send the message to the provider using the connection.
"FSSOAPService.doSyncCall: SENDING message\n" + xmlString);
}
return null;
}
// check the SOAP message for any SOAP related errors
// before passing control to SAML processor
output = new ByteArrayOutputStream();
"FSSOAPService.doSyncCall: REPLIED message:\n" + xmlString);
}
return reply;
}
/*
* Method to construct the URLEndpoint depending on whether basic
* authentication of one provider to another is to be done. Otherwise the
* SOAPEndpoint of the remote provider is returned
* @param response the response object
* @param partnerDecriptor the remote provider descriptor
* @param needAuthn determines forced authn
*/
boolean needAuthn
) throws IOException
{
// TODO: need to handle needAuthn correctly
// TODO: need to retrieve auth type, user name and password from meta
//basic authentication
if (needAuthn) {
int idnx = -1;
"createSOAPReceiverUrl: SOAP-Receiver-URL illegal format.");
return null;
}
{
data);
"mismatchAuthTypeandProtocol"));
return null;
}
{
data);
"mismatchAuthTypeandProtocol"));
return null;
}
} else {
return null;
}
{
"FSSOAPService.createSOAPReceiverUrl: " +
"PartnerSite required basic authentication. But " +
"the user name used for authentication is null.");
return null;
}
}
return null;
} else {
}
"FSSOAPService.createSOAPReceiverUrl: Sending message to URL: "
+ soapURL);
}
return soapURL;
}
/**
* Forms a SOAP Fault and puts it in the SOAP Message's Body.
*
* @param faultcode fault code to be set in SOAPMEssage
* @param faultString fault string
* @param detail the details of the fault condition
* @return <code>SOAPMessage</code> containing the SOAP fault
*/
) {
try {
"Problem"));
}
} catch( SOAPException e ) {
"FSSOAPService.formSOAPError:", e);
return null;
}
return msg;
}
/**
* Returns an instance of <code>FSSOAPService</code> instance.
*
* @return an instance of <code>FSSOAPService</code> instance.
*/
synchronized(FSServiceManager.class) {
"Constructing a new instance of FSSOAPService");
instance = new FSSOAPService();
}
return instance;
}
}
}