Top Description Inners Constructors Methods
org.mortbay.jetty.security

public abstract Class Credential

extends Object
Class Inheritance
Known Direct Subclasses
org.mortbay.jetty.security.Credential.Crypt, org.mortbay.jetty.security.Credential.MD5, org.mortbay.jetty.security.DigestAuthenticator.Digest, org.mortbay.jetty.security.Password
Imports
java.security.MessageDigest, org.mortbay.log.Log, org.mortbay.util.StringUtil, .TypeUtil

Credentials. The Credential class represents an abstract mechanism for checking authentication credentials. A credential instance either represents a secret, or some data that could only be derived from knowing the secret.

Often a Credential is related to a Password via a one way algorithm, so while a Password itself is a Credential, a UnixCrypt or MD5 digest of a a password is only a credential that can be checked against the password.

This class includes an implementation for unix Crypt an MD5 digest.

Author
Greg Wilkins (gregw)
See Also
Password

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Credential.Crypt

Unix Crypt Credentials

public static class
Credential.MD5

MD5 Credentials

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract boolean

Returns:

True if the credentials indicated that the shared secret is known to both this Credential and the passed credential.
check
(Object
The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.
credentials
)

Check a credential

public static Credential

Returns:

A Credential or Password instance.
getCredential
(String
String representation of the credential
credential
)

Get a credential from a String.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Credentialback to summary
public Credential()

Method Detail

checkback to summary
public abstract boolean check(Object credentials)

Check a credential

Parameters
credentials:Object

The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.

Returns:boolean

True if the credentials indicated that the shared secret is known to both this Credential and the passed credential.

getCredentialback to summary
public static Credential getCredential(String credential)

Get a credential from a String. If the credential String starts with a known Credential type (eg "CRYPT:" or "MD5:" ) then a Credential of that type is returned. Else the credential is assumed to be a Password.

Parameters
credential:String

String representation of the credential

Returns:Credential

A Credential or Password instance.

org.mortbay.jetty.security back to summary

public Class Credential.Crypt

extends Credential
Class Inheritance

Unix Crypt Credentials

Field Summary

Modifier and TypeField and Description
public static final String
private String

Constructor Summary

AccessConstructor and Description
pack-priv
Crypt(String cooked)

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Object
The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.
credentials
)

Implements abstract org.mortbay.jetty.security.Credential.check.

Check a credential
public static String
crypt(String user, String pw)

Inherited from org.mortbay.jetty.security.Credential:
getCredential

Field Detail

__TYPEback to summary
public static final String __TYPE
_cookedback to summary
private String _cooked

Constructor Detail

Cryptback to summary
pack-priv Crypt(String cooked)

Method Detail

checkback to summary
public boolean check(Object credentials)

Implements abstract org.mortbay.jetty.security.Credential.check.

Doc from org.mortbay.jetty.security.Credential.check.

Check a credential

Parameters
credentials:Object

The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.

Returns:boolean

True if the credentials indicated that the shared secret is known to both this Credential and the passed credential.

cryptback to summary
public static String crypt(String user, String pw)
org.mortbay.jetty.security back to summary

public Class Credential.MD5

extends Credential
Class Inheritance

MD5 Credentials

Field Summary

Modifier and TypeField and Description
private static MessageDigest
public static final Object
public static final String
private byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
MD5(String digest)

Method Summary

Modifier and TypeMethod and Description
public boolean
check(Object
The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.
credentials
)

Implements abstract org.mortbay.jetty.security.Credential.check.

Check a credential
public static String
digest(String password)

public byte[]
Inherited from org.mortbay.jetty.security.Credential:
getCredential

Field Detail

__mdback to summary
private static MessageDigest __md
__md5Lockback to summary
public static final Object __md5Lock
__TYPEback to summary
public static final String __TYPE
_digestback to summary
private byte[] _digest

Constructor Detail

MD5back to summary
pack-priv MD5(String digest)

Method Detail

checkback to summary
public boolean check(Object credentials)

Implements abstract org.mortbay.jetty.security.Credential.check.

Doc from org.mortbay.jetty.security.Credential.check.

Check a credential

Parameters
credentials:Object

The credential to check against. This may either be another Credential object, a Password object or a String which is interpreted by this credential.

Returns:boolean

True if the credentials indicated that the shared secret is known to both this Credential and the passed credential.

digestback to summary
public static String digest(String password)
getDigestback to summary
public byte[] getDigest()