|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mobicents.servlet.sip.security.authentication.AuthenticatorBase
org.mobicents.servlet.sip.security.authentication.DigestAuthenticator
public class DigestAuthenticator
An Authenticator and Valve implementation of HTTP DIGEST Authentication (see RFC 2069). Modified for SIP authentication.
| Field Summary | |
|---|---|
protected static java.lang.String |
INFO
Descriptive information about this implementation. |
protected java.lang.String |
key
Private key. |
protected static java.security.MessageDigest |
md5Helper
MD5 message digest provider. |
| Fields inherited from class org.mobicents.servlet.sip.security.authentication.AuthenticatorBase |
|---|
algorithm, cache, context, DEFAULT_ALGORITHM, digest, entropy, random, randomClass, STRING_MANAGER |
| Constructor Summary | |
|---|---|
DigestAuthenticator()
|
|
| Method Summary | |
|---|---|
boolean |
authenticate(SipServletRequestImpl request,
SipServletResponseImpl response,
SipLoginConfig config)
Authenticate the user making this request, based on the specified login configuration. |
protected static java.security.Principal |
findPrincipal(SipServletRequestImpl request,
java.lang.String authorization,
org.apache.catalina.Realm realm)
Parse the specified authorization credentials, and return the associated Principal that these credentials authenticate (if any) from the specified Realm. |
protected java.lang.String |
generateNOnce(SipServletRequestImpl request)
Generate a unique token. |
static javax.sip.header.AuthorizationHeader |
getAuthorizationHeader(java.lang.String method,
java.lang.String uri,
java.lang.String requestBody,
javax.sip.header.Header authHeader,
java.lang.String username,
java.lang.String password,
java.lang.String nonce)
Generates an authorisation header in response to wwwAuthHeader. |
java.lang.String |
getInfo()
Return descriptive information about this Valve implementation. |
java.security.Principal |
getPrincipal()
|
protected java.lang.String |
parseUsername(java.lang.String authorization)
Parse the username from the specified authorization string. |
protected static java.lang.String |
removeQuotes(java.lang.String quotedString)
Removes the quotes on a string. |
protected static java.lang.String |
removeQuotes(java.lang.String quotedString,
boolean quotesRequired)
Removes the quotes on a string. |
protected void |
setAuthenticateHeader(SipServletRequestImpl request,
SipServletResponseImpl response,
SipLoginConfig config,
java.lang.String nOnce)
Generates the WWW-Authenticate header. |
| Methods inherited from class org.mobicents.servlet.sip.security.authentication.AuthenticatorBase |
|---|
getAlgorithm, getCache, getContext, getDigest, getEntropy, getRandom, getRandomClass, register, setAlgorithm, setCache, setContext, setEntropy, setRandomClass |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String INFO
protected static volatile java.security.MessageDigest md5Helper
protected java.lang.String key
| Constructor Detail |
|---|
public DigestAuthenticator()
| Method Detail |
|---|
public java.lang.String getInfo()
getInfo in class AuthenticatorBase
public boolean authenticate(SipServletRequestImpl request,
SipServletResponseImpl response,
SipLoginConfig config)
throws java.io.IOException
true if any specified
constraint has been satisfied, or false if we have
created a response challenge already.
authenticate in class AuthenticatorBaserequest - Request we are processingresponse - Response we are creatingconfig - Login configuration describing how authentication
should be performed
java.io.IOException - if an input/output error occurs
protected static java.security.Principal findPrincipal(SipServletRequestImpl request,
java.lang.String authorization,
org.apache.catalina.Realm realm)
null.
request - HTTP servlet requestauthorization - Authorization credentials from this requestrealm - Realm used to authenticate Principalsprotected java.lang.String parseUsername(java.lang.String authorization)
null
authorization - Authorization string to be parsed
protected static java.lang.String removeQuotes(java.lang.String quotedString,
boolean quotesRequired)
protected static java.lang.String removeQuotes(java.lang.String quotedString)
protected java.lang.String generateNOnce(SipServletRequestImpl request)
request - HTTP Servlet request
protected void setAuthenticateHeader(SipServletRequestImpl request,
SipServletResponseImpl response,
SipLoginConfig config,
java.lang.String nOnce)
The header MUST follow this template :
WWW-Authenticate = "WWW-Authenticate" ":" "Digest"
digest-challenge
digest-challenge = 1#( realm | [ domain ] | nOnce |
[ digest-opaque ] |[ stale ] | [ algorithm ] )
realm = "realm" "=" realm-value
realm-value = quoted-string
domain = "domain" "=" <"> 1#URI <">
nonce = "nonce" "=" nonce-value
nonce-value = quoted-string
opaque = "opaque" "=" quoted-string
stale = "stale" "=" ( "true" | "false" )
algorithm = "algorithm" "=" ( "MD5" | token )
request - HTTP Servlet requestresponse - HTTP Servlet responseconfig - Login configuration describing how authentication
should be performednOnce - nonce token
public static javax.sip.header.AuthorizationHeader getAuthorizationHeader(java.lang.String method,
java.lang.String uri,
java.lang.String requestBody,
javax.sip.header.Header authHeader,
java.lang.String username,
java.lang.String password,
java.lang.String nonce)
method - method of the request being authenticateduri - digest-urirequestBody - the body of the request.authHeader - the challenge that we should respond tousername - password -
OperationFailedException - if auth header was malformated.public java.security.Principal getPrincipal()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||