org.openid4java.association
Class AssociationSessionType

java.lang.Object
  extended by org.openid4java.association.AssociationSessionType
All Implemented Interfaces:
java.lang.Comparable

public class AssociationSessionType
extends java.lang.Object
implements java.lang.Comparable

Modells the session and association types allowed in OpenID associations.

Association requests and responses must have one of the AssociationSessionType's defined here.

Compatibility mode flag defines backwards-compatibile value sets allowed in OpenID 1.x, but not in OpenID 2

Author:
Marius Scurtescu, Johnny Bufu
See Also:
DiffieHellmanSession

Field Summary
private  java.lang.String _assocType
          Association type; possible values are HMAC-SHA1 and HMAC-SHA256.
private  boolean _compat
          Compatibility mode flag defines backwards-compatibile value sets allowed in OpenID 1.x, but not in OpenID 2
private  java.lang.String _hAlgorithm
          The H algorithm used for Diffie-Hellman sessions.
private static org.apache.commons.logging.Log _log
           
private  int _order
          Field used for ordering and comparing the encryption 'level' of AssociationSessionType's.
private  java.lang.String _sessType
          Session type; possible values are 'no-encryption', DH-*; can be blank or null in compatibility mode.
private static boolean DEBUG
           
static AssociationSessionType DH_COMPAT_SHA1
           
static AssociationSessionType DH_SHA1
           
static AssociationSessionType DH_SHA256
           
static AssociationSessionType NO_ENCRYPTION_COMPAT_SHA1MAC
           
static AssociationSessionType NO_ENCRYPTION_SHA1MAC
           
static AssociationSessionType NO_ENCRYPTION_SHA256MAC
           
 
Constructor Summary
private AssociationSessionType(java.lang.String sessType, java.lang.String hAlgorithm, java.lang.String assocType, boolean compat, int order)
          Creates a AssociationSessionType with all the specified parameters.
 
Method Summary
 int compareTo(java.lang.Object object)
          Compares to another AssociationSessionType; used for sorting.
static AssociationSessionType create(java.lang.String sessType)
          Creates a OpenID 2 AssociationSessionType with the specified session type and HMAC-SHA1 association type.
static AssociationSessionType create(java.lang.String sessType, java.lang.String assocType)
          Creates a OpenID 2 AssociationSessionType with the specified session and association types.
static AssociationSessionType create(java.lang.String sessType, java.lang.String assocType, boolean compatibility)
          Creates a AssociationSessionType with the specified session and association types.
 java.lang.String getAssociationType()
          Gets the association type.
 java.lang.String getHAlgorithm()
          Gets the H algorithm of the Diffie-Hellman session, or null for no-encryption session types.
 int getKeySize()
          Gets the MAC key size, in bits, of this association type.
 java.lang.String getSessionType()
          Gets the session type.
 boolean isBetter(AssociationSessionType other)
          Returns true if the specified argument's encryption level is considered better than the one of the current instance.
 boolean isVersion2()
          Returns true for OpenID 2 AssociationSessionType's, or false for OpenID 1.x types.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_log

private static org.apache.commons.logging.Log _log

DEBUG

private static final boolean DEBUG

NO_ENCRYPTION_SHA1MAC

public static final AssociationSessionType NO_ENCRYPTION_SHA1MAC

NO_ENCRYPTION_COMPAT_SHA1MAC

public static final AssociationSessionType NO_ENCRYPTION_COMPAT_SHA1MAC

NO_ENCRYPTION_SHA256MAC

public static final AssociationSessionType NO_ENCRYPTION_SHA256MAC

DH_SHA1

public static final AssociationSessionType DH_SHA1

DH_COMPAT_SHA1

public static final AssociationSessionType DH_COMPAT_SHA1

DH_SHA256

public static final AssociationSessionType DH_SHA256

_sessType

private java.lang.String _sessType
Session type; possible values are 'no-encryption', DH-*; can be blank or null in compatibility mode.


_hAlgorithm

private java.lang.String _hAlgorithm
The H algorithm used for Diffie-Hellman sessions. Null for no-encryption sessions.


_assocType

private java.lang.String _assocType
Association type; possible values are HMAC-SHA1 and HMAC-SHA256.


_compat

private boolean _compat
Compatibility mode flag defines backwards-compatibile value sets allowed in OpenID 1.x, but not in OpenID 2


_order

private int _order
Field used for ordering and comparing the encryption 'level' of AssociationSessionType's.

See Also:
isBetter(AssociationSessionType)
Constructor Detail

AssociationSessionType

private AssociationSessionType(java.lang.String sessType,
                               java.lang.String hAlgorithm,
                               java.lang.String assocType,
                               boolean compat,
                               int order)
Creates a AssociationSessionType with all the specified parameters.

Parameters:
sessType - Session type
hAlgorithm - H algorithm for Diffie-Hellman sessions
assocType - Association type
compat - True for compatibility-mode types, false otherwise
order - internal order, used for sorting encryption level
Method Detail

create

public static AssociationSessionType create(java.lang.String sessType)
                                     throws AssociationException
Creates a OpenID 2 AssociationSessionType with the specified session type and HMAC-SHA1 association type.

Parameters:
sessType - The session type.
Throws:
AssociationException

create

public static AssociationSessionType create(java.lang.String sessType,
                                            java.lang.String assocType)
                                     throws AssociationException
Creates a OpenID 2 AssociationSessionType with the specified session and association types.

Parameters:
sessType - The session type.
assocType - The association type.
Throws:
AssociationException

create

public static AssociationSessionType create(java.lang.String sessType,
                                            java.lang.String assocType,
                                            boolean compatibility)
                                     throws AssociationException
Creates a AssociationSessionType with the specified session and association types.

Compatibility flag defines backwards-compatibile value sets allowed in OpenID 1.x, but not in OpenID 2

Parameters:
sessType - The session type.
assocType - The association type.
compatibility - True for OpenID 1.x association / session types.
Throws:
AssociationException - For unsupported parameter sets.

getSessionType

public java.lang.String getSessionType()
Gets the session type.


getHAlgorithm

public java.lang.String getHAlgorithm()
Gets the H algorithm of the Diffie-Hellman session, or null for no-encryption session types.


getAssociationType

public java.lang.String getAssociationType()
Gets the association type.


getKeySize

public int getKeySize()
Gets the MAC key size, in bits, of this association type.


compareTo

public int compareTo(java.lang.Object object)
Compares to another AssociationSessionType; used for sorting.

Specified by:
compareTo in interface java.lang.Comparable

isBetter

public boolean isBetter(AssociationSessionType other)
Returns true if the specified argument's encryption level is considered better than the one of the current instance.


isVersion2

public boolean isVersion2()
Returns true for OpenID 2 AssociationSessionType's, or false for OpenID 1.x types.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright 2006-2008 Sxip Identity Corporation