/**
* 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: FSSSOAndFedService.java,v 1.8 2009/06/19 02:45:50 bigfatrat Exp $
*
*/
/**
* <code>IDP</code> Single Sign On Service.
*/
/**
* Initializes the servlet.
* @param config <code>ServletConfig</code> object
* @exception ServletException if the initialization failed
*/
try {
} catch (SOAPException ex) {
"FSSSOAndFedService.init: create message factory failed.", ex);
}
}
/**
* Processes single sign on request.
* @param request <code>HttpServletRequest</code> object
* @param response <code>HttpServletResponse</code> object
* @exception ServletException, IOException if an error occurred
*/
public void doGet(
) throws ServletException, IOException
{
return;
}
return;
}
// check for post authn
boolean bPostAuthn = false;
boolean bLECP = false;
if (authnIndicator == null) {
"FSSSOAndFedService.doGet:Pre Authentication SSO");
bPostAuthn = false;
} else {
"FSSSOAndFedService.doGet:Post Authentication SSO");
bPostAuthn = true;
if (lecpIndicator == null) {
"FSSSOAndFedService.doGet:non LECP request");
bLECP = false;
} else {
"FSSSOAndFedService.doGet:post Authn LECP request");
bLECP = true;
}
//Start Change
if (authnRequest == null) {
"FSSSOAndFedService.doGet: authnRequest is null");
}
"FSSSOAndFedService.doGet: authnContext is null. " +
"Using default password");
}
}
//End Change
if (authnRequest != null &&
hostEntityId != null &&
authnContext != null &&
{
return;
} else {
+ "AuthnRequest not found in FSSessionManager");
return;
}
}
// obtain AuthnRequest message
//decode and create FSAuthnRequest object
try {
if (authnRequest == null){
return;
}
} catch(FSException e){
", queryString=" +
request.getQueryString(), e);
return;
}
try {
} catch (Exception e) {
"FSSSOAndFedService: couldn't obtain hosted entity id:",e);
}
}
return;
}
/**
* Processes single sign on POST request.
* @param request <code>HttpServletRequest</code> object
* @param response <code>HttpServletResponse</code> object
* @exception ServletException, IOException if an error occurred
*/
public void doPost(
) throws ServletException, IOException
{
return;
}
return;
}
// Check if it's an LECP request
if (isLECPRequest(request)) {
// TODO: assume auth framework will understand this param
if (useForward != null &&
// this is a forward POST after authentication, need to
// use GET instead of POST here
"FSSSOAndFedService.doPost: LECP forward");
} else {
try {
} catch (SOAPException se) {
throw new ServletException(se);
}
}
return;
}
// obtain AuthnRequest message
if (enocodedAuthnRequest == null){
return;
}
+ "BASE64 encoded AuthnRequest at the RECEIVER: "
}
//decode and create FSAuthnRequest object
try {
if (authnRequest == null){
return;
} else {
"AuthnRequest received:" +
}
}
} catch(FSException e){
}
return;
}
try {
} catch (Exception e) {
"FSSSOAndFedService: couldn't obtain hosted entity id:",e);
}
}
false,
false,
return;
}
/**
* Check if this is an LECP authentication request.
*
* @param request <code>HttpServletRequest</code> object
* @return <code>true</code> if it's an LECP request; <code>false</code>
* otherwise.
*/
if (lecpHeader != null) {
return true;
}
return true;
}
return false;
}
private void handleAuthnRequest(
boolean bLECP,
) {
// post authn process
try {
if (hostedConfig != null) {
}
} catch (Exception e) {
+ "Couldn't obtain hosted meta:", e);
}
}
/* Not really useful.
String nameRegisDone =
request.getParameter(IFSConstants.NAMEREGIS_INDICATOR_PARAM);
boolean doNameRegis = false;
String doNameRegisStr =
IDFFMetaUtils.getFirstAttributeValueFromConfig(
hostedConfig, IFSConstants.ENABLE_REGISTRATION_AFTER_SSO);
if (doNameRegisStr != null && doNameRegisStr.equalsIgnoreCase("true")) {
doNameRegis = true;
}
*/
try {
+ "session token is null.");
return;
+ "session token is not valid.");
return;
} else {
"FSSSOAndFedService.handleAuthnRequest: "
+ "session token is valid.");
}
}
} else {
}
} catch(SessionException se) {
return;
}
try {
return;
}
/* Not useful at all. Commented out for now.
if (doNameRegis &&
(nameRegisDone == null ||
!nameRegisDone.equals(IFSConstants.TRUE)) &&
!authnRequest.getFederate())
{
// have to do nameregis now
Map queryMap = new HashMap();
queryMap.put(IFSConstants.AUTH_REQUEST_ID,
authnRequest.getRequestID());
queryMap.put(IFSConstants.PROVIDER_ID_KEY,hostEntityId);
queryMap.put(IFSConstants.AUTHN_CONTEXT,authnContext);
FSServiceManager instSManager = FSServiceManager.getInstance();
if (instSManager != null) {
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message(
"FSSSOAndFedService.handleAuthnRequest:" +
"FSServiceManager Instance not null");
}
try {
FSNameRegistrationHandler handlerObj =
instSManager.getNameRegistrationHandler(
realm, remoteEntityID, IFSConstants.SP);
SPDescriptorType remoteProviderDesc =
metaManager.getSPDescriptor(realm,remoteEntityID);
if (handlerObj != null) {
handlerObj.setHostedDescriptor(hostedDesc);
handlerObj.setHostedDescriptorConfig(hostedConfig);
handlerObj.setMetaAlias(metaAlias);
handlerObj.setHostedEntityId(hostEntityId);
handlerObj.handleNameRegistration(
request,
response,
ssoToken,
(HashMap)queryMap);
if (FSUtils.debug.messageEnabled()) {
FSUtils.debug.message(
"FSSSOAndFedService.handleAuthnRequest:" +
"Control returned from name registration");
}
if (!FSServiceUtils.isRegisProfileSOAP(userID,
remoteEntityID,
remoteProviderDesc,
metaAlias,
hostedDesc))
{
return;
}
}
} catch (Exception ex){
FSUtils.debug.error(
"FSSSOAndFedService.handleAuthnRequest:Error in " +
"invoking Name registration. returning.", ex);
return;
}
}
}
*/
} catch(FSAccountMgmtException exp) {
"FSSSOAndFedService:: handleAuthnRequest()" +
" No account information avialable for user. " +
}
}
true,
}
private void handleAuthnRequest(
boolean bPostAuthn,
boolean bLECP,
{
try {
}
} catch (SessionException e) {
}
try {
} else {
// remove it from authn request map
}
// handle sso
+ "Trying to handle AuthnRequest message: "
+ authnRequest.toXMLString());
"FSSSOAndFedService.handleAuthnRequest: " +
"AuthnRequest extensions: " +
}
}
if (!bLECP) {
handler =
} else {
}
+ "could not create SSOAndFedHandler");
session);
return;
}
}
return;
try {
se.getMessage());
} catch(IOException ex){
+ ex.getMessage());
}
return;
}
}
/**
* Default constructor.
*/
public FSSSOAndFedService() {
}
/**
* SOAP JAXM Listener implementation for LECP AuthnRequest.
*
* @param request <code>HttpServletRequest</code> object
* @param response <code>HttpServletResponse</code> object
* @param message SOAP message that contains LECP request
*/
{
try {
+ "Error in processing. Invalid SOAPMessage");
response);
return;
}
+ " localName: " + nodeName);
}
{
try {
retMessage = null;
} catch(Exception e){
+ "Error in processing lecp AuthnRequest:", e);
response);
return;
}
return;
} else {
"FSSSOAndFedService.onMessage: Invalid SOAP Request:" +
nodeName);
}
} catch(Exception e) {
+ "Error in processing Request: Exception occured: ", e);
response);
return;
}
response);
return;
}
/**
* Handles LECP AuthnRequest.
*
* @param request <code>HttpServletRequest</code> object
* @param response <code>HttpServletResponse</code> object
* @param authnRequest <code>FSAuthnRequest</code> object
* @param hostedDesc hosted identity provider's meta descriptor
* @param hostedConfig hosted identity provider's extended meta
* @param realm The realm under which the entity resides
* @param hostEntityId hosted identity provider's entity id
* @param metaAlias hosted identity provider's meta alias
*/
private void handleLECPRequest(
{
try {
// handle sso
"processing LECP request failed." + se);
return;
}
}
/**
* Forms and Returns SOAP message to the requested client.
*
* @param msg <code>SOAPMessage</code> to be returned
* @param response <code>HttpServletResponse</code> object
*/
{
try {
return;
} else {
return;
}
} catch(Exception e) {
+ "Exception::", e);
return;
}
}
}