com.ibm.atp.auth
Class AuthPacket

java.lang.Object
  extended bycom.ibm.atp.auth.AuthPacket

public class AuthPacket
extends java.lang.Object

The AuthPacket class is the challenge-response authentication packet class.

Version:
1.00 $Date: 2002/02/20 22:17:18 $
Author:
ONO Kouichi

Field Summary
private  Challenge _challenge
          Challenge
private  java.lang.String _domain
           
private  java.util.Vector _domains
          Security domain
private  int _manner
          Authentication manner
private  Response _response
          ByteSequence
private  java.lang.String _serverid
           
private  int _status
          Status of authentication
private  int _step
           
protected static java.lang.String AUTH_MANNER_DIGEST
           
protected static java.lang.String AUTH_MANNER_FIELDNAME
          Authentication manner
protected static java.lang.String AUTH_MANNER_SIGNATURE
           
protected static java.lang.String AUTHENTICATION_PROTOCOL_VERSION
          Authentication protocol version
protected static java.lang.String CHALLENGE_FIELDNAME
          Challenge
protected static java.lang.String CRLF
          carriage return & line feed
protected static java.lang.String DOMAIN_FIELDNAME
           
protected static java.lang.String DOMAIN_SEPARATOR
          Security Domain
protected static java.lang.String DOMAINS_FIELDNAME
           
protected static java.lang.String END_OF_PACKET
          end of packet
protected static java.lang.String FIELD_SEPARATOR
          Field separator
private static LogCategory log
           
protected static java.lang.String RESPONSE_FIELDNAME
          Response
private static java.lang.String SERVERID
          Identifier of aglet server
protected static java.lang.String SERVERID_FIELDNAME
          Identifier of aglet server
protected static java.lang.String STEP_END
           
protected static java.lang.String STEP_FIRST_TURN
           
protected static java.lang.String STEP_SECOND_TURN
           
protected static java.lang.String STEP_START
          Step of authentication protocol
private static boolean verbose
          verbose
 
Constructor Summary
AuthPacket(java.io.DataInput di)
          Constructor for receiving packet
AuthPacket(int step, int status, java.util.Enumeration domains, int manner, Challenge challenge, Response response)
          Constructor for sending packet
AuthPacket(int step, int status, java.lang.String domain, int manner, Challenge challenge, Response response)
          Constructor for sending packet
 
Method Summary
private  void clear()
          Clear
private static java.lang.String decode(java.lang.String str)
           
private static java.lang.String encode(java.lang.String str)
           
 int getAuthManner()
          Gets authentication manner.
protected  java.lang.String getAuthMannerField()
          Gets authentication manner field.
 Challenge getChallenge()
          Gets challenge.
protected  java.lang.String getChallengeField()
          Gets challenge field.
 Response getResponse()
          Gets response to challenge.
protected  java.lang.String getResponseField()
          Gets response to challenge field.
 java.lang.String getSecurityDomain()
          Gets security domain name.
protected  java.lang.String getSecurityDomainField()
          Gets security domain field.
 java.lang.String getSecurityDomainList()
          Gets security domain name list.
 java.util.Enumeration getSecurityDomains()
          Gets security domain names.
protected  java.lang.String getSecurityDomainsField()
          Gets security domains field.
 java.lang.String getServerID()
          Gets server ID.
protected  java.lang.String getServerIDField()
          Gets server ID field.
 int getStatus()
          Gets authentication status.
protected  java.lang.String getStatusString()
          Gets string of authentication status.
 int getStep()
          Gets authentication protocol step.
protected  java.lang.String getStepString()
          Gets string of authentication protocol step.
static boolean isTopLine(java.lang.String line)
          Checks the line is top line.
(package private) static boolean isVerbose()
           
 void parseBody(java.io.DataInput di)
          Parses body of packet from data input stream.
private  void parseLine(java.lang.String line)
          Parse line.
 void parseTopLine(java.lang.String topLine)
          Parses top line.
 void readFrom(java.io.DataInput di)
          Reads packet from data input stream.
 void readFrom(java.lang.String topLine, java.io.DataInput di)
          Reads packet from data input stream.
private  void setAuthManner(int manner)
          Sets authentication manner.
private  void setAuthManner(java.lang.String manner)
          Sets authentication manner.
private  void setChallenge(Challenge challenge)
          Sets challenge.
private  void setChallenge(java.lang.String challenge)
          Sets challenge.
private  void setResponse(Response response)
          Sets response to challenge.
private  void setResponse(java.lang.String response)
          Sets response to challenge.
private  void setSecurityDomain(java.lang.String name)
          Sets security domain name.
private  void setSecurityDomains(java.util.Enumeration names)
          Sets security domain names.
private  void setSecurityDomains(java.lang.String namelist)
          Sets security domain names.
private  void setServerID(java.lang.String id)
          Sets server ID.
private  void setStatus(int status)
          Sets authentication status.
private  void setStatus(java.lang.String status)
          Sets authentication status.
private  void setStep(int step)
          Sets authentication protocol step.
private  void setStep(java.lang.String step)
          Sets authentication protocol step.
static int toAuthManner(java.lang.String manner)
          Converts to authentication manner.
static int toAuthManner(java.lang.String manner, int defaultManner)
          Converts to authentication manner.
static java.lang.String toAuthMannerString(int manner)
          Converts to string of authentication manner.
(package private) static void verboseOut(java.lang.String msg)
           
 void writeTo(java.io.OutputStream out)
          Writes packet to output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final LogCategory log

CRLF

protected static final java.lang.String CRLF
carriage return & line feed

See Also:
Constant Field Values

END_OF_PACKET

protected static final java.lang.String END_OF_PACKET
end of packet

See Also:
Constant Field Values

AUTHENTICATION_PROTOCOL_VERSION

protected static final java.lang.String AUTHENTICATION_PROTOCOL_VERSION
Authentication protocol version

See Also:
Constant Field Values

FIELD_SEPARATOR

protected static final java.lang.String FIELD_SEPARATOR
Field separator

See Also:
Constant Field Values

SERVERID_FIELDNAME

protected static final java.lang.String SERVERID_FIELDNAME
Identifier of aglet server

See Also:
Constant Field Values

DOMAIN_SEPARATOR

protected static final java.lang.String DOMAIN_SEPARATOR
Security Domain

See Also:
Constant Field Values

DOMAINS_FIELDNAME

protected static final java.lang.String DOMAINS_FIELDNAME
See Also:
Constant Field Values

DOMAIN_FIELDNAME

protected static final java.lang.String DOMAIN_FIELDNAME
See Also:
Constant Field Values

AUTH_MANNER_FIELDNAME

protected static final java.lang.String AUTH_MANNER_FIELDNAME
Authentication manner

See Also:
Constant Field Values

AUTH_MANNER_DIGEST

protected static final java.lang.String AUTH_MANNER_DIGEST
See Also:
Constant Field Values

AUTH_MANNER_SIGNATURE

protected static final java.lang.String AUTH_MANNER_SIGNATURE
See Also:
Constant Field Values

CHALLENGE_FIELDNAME

protected static final java.lang.String CHALLENGE_FIELDNAME
Challenge

See Also:
Constant Field Values

RESPONSE_FIELDNAME

protected static final java.lang.String RESPONSE_FIELDNAME
Response

See Also:
Constant Field Values

SERVERID

private static java.lang.String SERVERID
Identifier of aglet server


_serverid

private java.lang.String _serverid

verbose

private static boolean verbose
verbose


STEP_START

protected static final java.lang.String STEP_START
Step of authentication protocol

See Also:
Constant Field Values

STEP_FIRST_TURN

protected static final java.lang.String STEP_FIRST_TURN
See Also:
Constant Field Values

STEP_SECOND_TURN

protected static final java.lang.String STEP_SECOND_TURN
See Also:
Constant Field Values

STEP_END

protected static final java.lang.String STEP_END
See Also:
Constant Field Values

_step

private int _step

_status

private int _status
Status of authentication


_domains

private java.util.Vector _domains
Security domain


_domain

private java.lang.String _domain

_manner

private int _manner
Authentication manner


_challenge

private Challenge _challenge
Challenge


_response

private Response _response
ByteSequence

Constructor Detail

AuthPacket

public AuthPacket(int step,
                  int status,
                  java.lang.String domain,
                  int manner,
                  Challenge challenge,
                  Response response)
Constructor for sending packet

Parameters:
step - step of authentication protocol
status - status of authentication protocol
domain - security domain name
manner - authenticatoin manner by challenge-response
challenge - challenge for authentication
response - response of challenge

AuthPacket

public AuthPacket(int step,
                  int status,
                  java.util.Enumeration domains,
                  int manner,
                  Challenge challenge,
                  Response response)
Constructor for sending packet

Parameters:
step - step of authentication protocol
status - status of authentication protocol
domains - security domain names
manner - authenticatoin manner by challenge-response
challenge - challenge for authentication
response - response of challenge

AuthPacket

public AuthPacket(java.io.DataInput di)
Constructor for receiving packet

Method Detail

clear

private final void clear()
Clear


decode

private static java.lang.String decode(java.lang.String str)

encode

private static java.lang.String encode(java.lang.String str)

getAuthManner

public final int getAuthManner()
Gets authentication manner.

Returns:
authentication manner

getAuthMannerField

protected final java.lang.String getAuthMannerField()
Gets authentication manner field.

Returns:
authentication manner field

getChallenge

public final Challenge getChallenge()
Gets challenge.

Returns:
challenge

getChallengeField

protected final java.lang.String getChallengeField()
Gets challenge field.

Returns:
challenge field

getResponse

public final Response getResponse()
Gets response to challenge.

Returns:
response to challenge

getResponseField

protected final java.lang.String getResponseField()
Gets response to challenge field.

Returns:
response to challenge field

getSecurityDomain

public final java.lang.String getSecurityDomain()
Gets security domain name.

Returns:
security domain name

getSecurityDomainField

protected final java.lang.String getSecurityDomainField()
Gets security domain field.

Returns:
security domain field

getSecurityDomainList

public final java.lang.String getSecurityDomainList()
Gets security domain name list.

Returns:
security domain name list (URI encoded)

getSecurityDomains

public final java.util.Enumeration getSecurityDomains()
Gets security domain names.

Returns:
security domain names

getSecurityDomainsField

protected final java.lang.String getSecurityDomainsField()
Gets security domains field.

Returns:
security domains field

getServerID

public final java.lang.String getServerID()
Gets server ID.

Returns:
server ID

getServerIDField

protected final java.lang.String getServerIDField()
Gets server ID field.

Returns:
server ID field

getStatus

public final int getStatus()
Gets authentication status.

Returns:
authentication status

getStatusString

protected final java.lang.String getStatusString()
Gets string of authentication status.

Returns:
string of authentication status

getStep

public final int getStep()
Gets authentication protocol step.

Returns:
authentication protocol step

getStepString

protected final java.lang.String getStepString()
Gets string of authentication protocol step.

Returns:
string of authentication protocol step

isTopLine

public static boolean isTopLine(java.lang.String line)
Checks the line is top line.

Parameters:
line - line of protocol
Returns:
true if the line is top line of authentication protocol, otherwise false.

isVerbose

static final boolean isVerbose()

parseBody

public void parseBody(java.io.DataInput di)
               throws java.io.IOException
Parses body of packet from data input stream.

Throws:
java.io.IOException

parseLine

private void parseLine(java.lang.String line)
                throws java.io.IOException
Parse line.

Parameters:
line - line of authentication protocol
Throws:
java.io.IOException

parseTopLine

public void parseTopLine(java.lang.String topLine)
                  throws java.io.IOException
Parses top line.

Parameters:
topLine - top line of authentication protocol
Throws:
java.io.IOException

readFrom

public void readFrom(java.io.DataInput di)
              throws java.io.IOException
Reads packet from data input stream.

Throws:
java.io.IOException

readFrom

public void readFrom(java.lang.String topLine,
                     java.io.DataInput di)
              throws java.io.IOException
Reads packet from data input stream.

Parameters:
topLine - top line of packet
Throws:
java.io.IOException

setAuthManner

private final void setAuthManner(int manner)
                          throws java.lang.IllegalArgumentException
Sets authentication manner.

Parameters:
manner - authentication manner
Throws:
java.lang.IllegalArgumentException

setAuthManner

private final void setAuthManner(java.lang.String manner)
                          throws java.lang.IllegalArgumentException
Sets authentication manner.

Parameters:
manner - string of authentication manner
Throws:
java.lang.IllegalArgumentException

setChallenge

private final void setChallenge(Challenge challenge)
Sets challenge.

Parameters:
challenge - challenge

setChallenge

private final void setChallenge(java.lang.String challenge)
Sets challenge.

Parameters:
challenge - string of challenge

setResponse

private final void setResponse(Response response)
Sets response to challenge.

Parameters:
response - response to challenge

setResponse

private final void setResponse(java.lang.String response)
Sets response to challenge.

Parameters:
response - string of response to challenge

setSecurityDomain

private final void setSecurityDomain(java.lang.String name)
Sets security domain name.

Parameters:
name - security domain name

setSecurityDomains

private final void setSecurityDomains(java.lang.String namelist)
Sets security domain names.


setSecurityDomains

private final void setSecurityDomains(java.util.Enumeration names)
Sets security domain names.

Parameters:
names - security domain names

setServerID

private final void setServerID(java.lang.String id)
Sets server ID.


setStatus

private final void setStatus(int status)
Sets authentication status.


setStatus

private final void setStatus(java.lang.String status)
Sets authentication status.


setStep

private final void setStep(int step)
                    throws java.lang.IllegalArgumentException
Sets authentication protocol step.

Parameters:
step - authentication protocol step
Throws:
java.lang.IllegalArgumentException

setStep

private final void setStep(java.lang.String step)
                    throws java.lang.IllegalArgumentException
Sets authentication protocol step.

Throws:
java.lang.IllegalArgumentException

toAuthManner

public static int toAuthManner(java.lang.String manner)
Converts to authentication manner.

Parameters:
manner - string of authentication manner
Returns:
authentication manner code

toAuthManner

public static int toAuthManner(java.lang.String manner,
                               int defaultManner)
Converts to authentication manner.

Parameters:
manner - string of authentication manner
defaultManner - default authentication manner code
Returns:
authentication manner code

toAuthMannerString

public static java.lang.String toAuthMannerString(int manner)
Converts to string of authentication manner.

Parameters:
manner - authentication manner code
Returns:
string of authentication manner

verboseOut

static final void verboseOut(java.lang.String msg)

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes packet to output stream.

Parameters:
out - output stream for packet
Throws:
java.io.IOException