AuthSSOToken.java revision 4709b991352c6de69ba02928ed6cbf373ca62ed5
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 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: AuthSSOToken.java,v 1.4 2009/01/16 10:49:02 manish_rustagi Exp $
*
*/
/*
* Portions Copyrighted [2011] [ForgeRock AS]
*/
public class AuthSSOToken implements SSOToken {
// %%% this should finally reside in HttpSession
.synchronizedMap(new HashMap());
// Variables to generate Keys
public static final int INVALID = 0;
public static final int VALID = 1;
public static final int DESTROYED = 3;
protected AuthContext authContext;
// %% session information should also get into HttpSession
private AuthSSOToken() {
// cannot be constructed
}
throws InvalidAuthContextException {
throw (new InvalidAuthContextException());
throw (new InvalidAuthContextException());
authContext = authc;
// Generate key (or tokenID);
}
byte[] keyRandom = new byte[12];
try {
} catch ( UnknownHostException unknownHostException) {
// This issue is due to Bug: MACOSX_PORT-564
{
}
} catch (Exception e) {
e.printStackTrace();
}
}
return (authContext.getPrincipal());
}
return ("ldap");
}
public int getAuthLevel() throws SSOException {
return (1);
}
try {
} catch (Exception e) {
throw (new SSOException(e));
}
}
try {
return hostName;
} catch (Exception e) {
throw (new SSOException(e));
}
}
public byte[] getAddress() throws SSOException {
return (getIPAddress().getAddress());
}
public long getTimeLeft() throws SSOException {
return (0);
}
return null;
}
public long getMaxSessionTime() throws SSOException {
return (0);
}
public long getIdleTime() throws SSOException {
return (0);
}
public long getMaxIdleTime() throws SSOException {
return (-1);
}
public SSOTokenID getTokenID() {
return (new AuthSSOTokenID(key));
}
protected int getState() throws SSOException {
if ((authContext != null)
return (VALID);
return (INVALID);
}
}
}
throws SSOException {
}
throws SSOException {
}
protected boolean isValid() {
if ((authContext != null)
return (true);
return (false);
}
protected void validate() throws SSOException {
if ((authContext != null)
return;
"invalidcontext", null);
}
protected void invalidate() {
// Remove itself from allSSOTokens MAP
try {
} catch (LoginException le) {
// do nothing
}
}
public boolean isTokenRestricted() throws SSOException {
throw new UnsupportedOperationException("This method is not supported");
}
throws SSOException {
throw new UnsupportedOperationException("This method is not supported");
}
protected class AuthSSOTokenID implements SSOTokenID {
protected AuthSSOTokenID(String t) {
tokenID = t;
}
return (tokenID);
}
if (this == object) {
return true;
return false;
}
}
public int hashCode() {
return authContext.hashCode();
}
}
}