/**
* 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: IdentityServicesHandler.java,v 1.7 2008/12/15 19:50:21 arviranga Exp $
*
*/
/*
* Portions Copyrighted 2011-2015 ForgeRock AS.
* Portions Copyrighted 2012 Open Source Solution Technology Corporation
*/
/**
* Provides a marshall/unmarshall layer to the Security interface.
*/
// =======================================================================
// Constants
// =======================================================================
// =======================================================================
// Fields
// =======================================================================
// =======================================================================
// =======================================================================
/**
* Loads the init parameters for use in the HTTP methods.
*
* @see javax.servlet.GenericServlet#init()
*/
super.init();
// determine if the provider is correct..
try {
// get the security provider from the params.
} catch (Exception e) {
// wrap in a servlet exception as to not scare the natives..
throw new ServletException(e);
}
}
// =======================================================================
// HTTP Methods
// =======================================================================
/**
* Determines unmarshalls the request and executes the proper method based
* on the request parameters.
*
* @see javax.servlet.http.HttpServlet#service(HttpServletRequest request,
* HttpServletResponse response)
*/
}
//set headers before executing the method, so they are set even if exception is being thrown
}
// =======================================================================
// Helper Methods
// =======================================================================
/**
* Get a consistent behaviour between application servers..
*/
}
return ret;
}
{
}
private void initLbCookieSettings() {
}
return;
}
return;
}
}
}
try {
// unable to set lb cookie
}
}
/**
* Enum to get the request parameters and test w/ the SecurityMethods.
*/
public static class SecurityParameter {
new SecurityParameter("URI");
new SecurityParameter("ACTION");
new SecurityParameter("USERNAME");
new SecurityParameter("PASSWORD");
new SecurityParameter("ATTRIBUTENAMES",
new SecurityParameter("LOGNAME");
new SecurityParameter("MESSAGE");
new SecurityParameter("NAME");
new SecurityParameter("FILTER");
// ===================================================================
// Fields
// ===================================================================
}
}
return name;
}
} else if (this.type == IdentityDetails.class) {
} else {
}
return ret;
}
}
}
return ret;
}
try {
// Check the cookie value "iPlanetDirectoryPro"
}
} catch (SSOException ex) {
// Ignore the exception, and no valid token
}
}
}
return ret;
}
}
}
}
return ret;
}
{
}
return ret;
}
{
break;
}
String attrValues[] =
}
}
if (attributeList == null) {
attributeList = new ArrayList();
}
} else {
// Add empyt attribute
if (attributeList == null) {
attributeList = new ArrayList();
}
}
}
}
}
return ret;
}
{
if (!isBlank(identityName)) {
rv = new IdentityDetails();
}
}
}
}
}
}
}
}
}
}
}
break;
}
String attrValues[] =
if (attrValues != null) {
}
}
} else {
}
}
}
}
}
return rv;
}
}
/**
* Defined by the interface 'com.sun.identity.idsvcs.Security'.
*/
public static class SecurityMethod {
// ===================================================================
// Constructors
// ===================================================================
SecurityParameter[] params) {
final Method[] SECURITY_METHODS =
IdentityServicesImpl.class.getMethods();
// find the method
Method m = SECURITY_METHODS[i];
// found the method by name..
// lets check based on parameters..
imethod = m;
break;
}
}
// need to throw if we can't find it..
throw new IllegalArgumentException();
}
// set the internal fields
this.parameters = params;
}
}
}
}
// ===================================================================
// Fields
// ===================================================================
throws ServletException, IOException {
// find the security method from the path..
// Set the respone content type
} else {
}
}
try {
// Throw Unsupported Operation Exception
return;
}
// execute the method w/ the parameters..
// marshall the response..
} else {
}
}
} catch (ObjectNotFound ex) {
// write out the proper ObjectNotFound exception.
// set the response error code
if(debug.messageEnabled()) {
}
try {
} catch (Exception e) {
// something really went wrong so just give up..
throw new ServletException(e);
}
} catch (GeneralFailure ex) {
// write out the proper security based exception..
if(debug.messageEnabled()) {
}
try {
} catch (Exception e) {
// something really went wrong so just give up..
throw new ServletException(e);
}
} catch (Throwable e) {
if(debug.messageEnabled()) {
}
try {
// something really went wrong so just give up..
if (e instanceof UnsupportedOperationException) {
} else if (e instanceof InvocationTargetException) {
} else {
}
throw new ServletException(ex);
}
} finally {
}
}
}
/**
* Gets the realm being used for this request by parsing the query parameters on the URI parameter (if present).
* This matches the logic used in opensso/IdentityServicesImpl. Defaults to "/".
*/
break;
}
}
}
return realm;
}
/**
* If both exist on the path then return JSON, XML, and then Properites
* in that order.
*/
// default is properties format
}
throws Throwable
{
// find the value for each parameter..
if (parameters != null) {
}
}
try {
// invoke the actual security param..
} catch (IllegalArgumentException e) {
throw new GeneralFailure(e.getMessage());
} catch (IllegalAccessException e) {
throw new GeneralFailure(e.getMessage());
} catch (InvocationTargetException e) {
if (debug.warningEnabled()) {
}
throw e.getTargetException();
}
}
}
}