001: /*
002: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions
006: * are met:
007: *
008: * - Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: *
011: * - Redistribution in binary form must reproduce the above copyright
012: * notice, this list of conditions and the following disclaimer in
013: * the documentation and/or other materials provided with the
014: * distribution.
015: *
016: * Neither the name of Sun Microsystems, Inc. or the names of
017: * contributors may be used to endorse or promote products derived
018: * from this software without specific prior written permission.
019: *
020: * This software is provided "AS IS," without a warranty of any
021: * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
022: * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
023: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
024: * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
025: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
026: * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
027: * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
028: * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
029: * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
030: * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
031: * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
032: *
033: * You acknowledge that Software is not designed, licensed or intended
034: * for use in the design, construction, operation or maintenance of
035: * any nuclear facility.
036: */
037: package com.sun.portal.siebelportlet.util;
038:
039: import java.util.Properties;
040: import java.util.Enumeration;
041: import java.util.logging.*;
042: import javax.servlet.http.HttpServletRequest;
043: import com.sun.portal.iwayutil.ssoadapterutils.*;
044:
045: public class SiebelSSOAdapterUtils implements SiebelConstants {
046:
047: Properties siebelSSOProps = null;
048: EAISSOAdapterConfigUtils ssoUtils = null;
049: Logger logger = null;
050:
051: public SiebelSSOAdapterUtils(HttpServletRequest httpReq,
052: String configName, String channleName) {
053: logger = SiebelLogger.getLogger();
054: ssoUtils = new EAISSOAdapterConfigUtils(configName, channleName);
055: siebelSSOProps = ssoUtils.getSSOAdapterAttributes(httpReq);
056: }
057:
058: public String getSiebelUserName() {
059: String name = null;
060:
061: if (siebelSSOProps != null) {
062: name = (String) siebelSSOProps.get(SSO_SIEBEL_USER);
063: }
064: debug("getSiebelUserName()", "Name : " + name);
065: return name;
066: }
067:
068: public String getSiebelPassword() {
069: String password = null;
070:
071: if (siebelSSOProps != null) {
072: password = (String) siebelSSOProps.get(SSO_SIEBEL_PASSWORD);
073: }
074: return password;
075: }
076:
077: public Properties getSiebelProperties() {
078: Properties props = null;
079:
080: if (siebelSSOProps != null) {
081: props = new Properties();
082: Enumeration enum = siebelSSOProps.propertyNames();
083: String name = null;
084: String value = null;
085: while (enum.hasMoreElements()) {
086: name = (String) enum.nextElement();
087: value = (String) siebelSSOProps.get(name);
088: props.put(name, value);
089: }
090: }
091: return props;
092: }
093:
094: public void setSSOAdapterAttributes(Properties attrs,
095: HttpServletRequest httpReq) {
096: ssoUtils.setSSOAdapterAttributes(attrs, httpReq);
097: }
098:
099: /**
100: * This method will print the log the messages.
101: **/
102: private void debug(String methodName, String msg) {
103: logger.log(Level.INFO,
104: "com.sun.portal.siebelportlet.util.SiebelSSOAdapterUtils :"
105: + methodName + ":" + msg);
106: }
107: }
|