/**
* 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: DiscoveryService.java,v 1.5 2008/12/05 00:18:30 exu Exp $
*
*/
/**
* Handles Liberty discovery service protocol.
*/
/**
* Default constructor.
*/
public DiscoveryService() {
}
/**
* Processes request.
* @param request in coming request <code>Message</code>
* @return response <code>Message</code>
* @exception Exception if an error occurred during the process.
*/
// log it
+ " didn't contain one SOAP body.");
}
+ "authentication mechanism =" + authnMech);
}
+ "Mechanism used is not supported by this service:"+authnMech);
"authnMechNotSupported"));
}
try {
provH = new ProviderHeader(
} catch (SOAPBindingException sbe) {
}
{
try {
} catch (Exception e) {
+ "couldn't generate Message with X509 token: ", e);
throw new DiscoveryException(e.getMessage());
}
} else {
try {
} catch (Exception e) {
+ "couldn't generate Message: ", e);
throw new DiscoveryException(e.getMessage());
}
}
} else if (body instanceof ModifyType) {
} else {
+ "is not a Disco message.");
}
// TODO:
//create other header if needed
//message.setOtherHeader()
return message;
}
/**
* Finds the resource offerings requested in the query.
* @param query The incoming Discovery Query request.
* @param message soapbinding message that contains info regarding sending
* identities that can be used in access control
* @return org.w3c.dom.Element which is the QueryResponse of this operation.
* Inside this QueryResponse, Credentials may be included, and
* ResourceID may be encrypted if required.
*/
throws JAXBException
{
} else {
}
boolean isB2E = false;
if(resourceID == null ||
// B2E case
isB2E = true;
}
if(!isB2E) {
// find the disco ResourceIDMapper from config
}
+ "user associated with the resourceID:" + resourceID);
try {
}
return doc.getDocumentElement();
}
+ userDN);
}
} else {
}
if (entryHandler == null) {
"DiscoService.lookup: null DiscoEntryHandler.");
return XMLUtils.toDOMDocument(
}
+ "NoResults for user:" + userDN);
}
} else {
}
if (DiscoServiceManager.needPolicyEvalLookup()) {
if (authorizer == null) {
return XMLUtils.toDOMDocument(
}
}
+ " check and directive handling, NoResults for:"
+ userDN);
}
} else {
}
}
}
return XMLUtils.toDOMDocument(
}
/**
* Updates resource offerings.
* @param modify The incoming Discovery Update request.
* @param message soapbinding message that contains info regarding sending
* identities that can be used in access control
* @return ModifyResponseType which includes Status of the operation.
*/
throws JAXBException
{
try {
resp =
} catch (JAXBException je) {
+ "ModifyResponse.");
throw je;
}
} else {
}
boolean isB2E = false;
if(resourceID == null ||
// B2E case
isB2E = true;
}
if(!isB2E) {
// find the disco ResourceIDMapper from config
}
+ providerID + "."
+ "Update";
+ "from resourceID: " + resourceID);
return resp;
}
// find the DiscoEntryHandler from config
} else {
}
// get flag if policy check for modify from config
if (DiscoServiceManager.needPolicyEvalUpdate()) {
{
return resp;
}
}
// now do the modify
+ "DiscoEntries through DiscoEntryHandler successfully.");
}
}
} else {
+ "DiscoEntries through DiscoEntryHandler.");
}
return resp;
}
{
if (authorizer == null) {
return false;
}
// policy eval for each removes
while (i.hasNext()) {
+ "remove entry not exits: " + entryID);
return false;
}
}
env))
{
+ "WSC is not authorized to remove entry: " + entryID);
return false;
}
}
}
// policy eval for each inserts
while (j.hasNext()) {
}
env))
{
+ "WSC is not authorized to insert entry.");
return false;
}
}
}
return true;
}
{
return null;
}
try {
}
} catch (Exception e) {
e);
}
return result;
}
}