Package org.apache.jackrabbit.server
Class BasicCredentialsProvider
- java.lang.Object
-
- org.apache.jackrabbit.server.BasicCredentialsProvider
-
- All Implemented Interfaces:
CredentialsProvider
public class BasicCredentialsProvider extends Object implements CredentialsProvider
This Class implements a credentials provider that extracts the credentials from the 'WWW-Authenticate' header and only supports 'Basic' authentication.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EMPTY_DEFAULT_HEADER_VALUE
static String
GUEST_DEFAULT_HEADER_VALUE
-
Constructor Summary
Constructors Constructor Description BasicCredentialsProvider(String defaultHeaderValue)
Constructs a new BasicCredentialsProvider with the given default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Credentials
getCredentials(javax.servlet.http.HttpServletRequest request)
Extracts the credentials from the given servlet request.
-
-
-
Field Detail
-
EMPTY_DEFAULT_HEADER_VALUE
public static final String EMPTY_DEFAULT_HEADER_VALUE
- See Also:
- Constant Field Values
-
GUEST_DEFAULT_HEADER_VALUE
public static final String GUEST_DEFAULT_HEADER_VALUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BasicCredentialsProvider
public BasicCredentialsProvider(String defaultHeaderValue)
Constructs a new BasicCredentialsProvider with the given default value. SeegetCredentials(javax.servlet.http.HttpServletRequest)
for details.- Parameters:
defaultHeaderValue
-
-
-
Method Detail
-
getCredentials
public Credentials getCredentials(javax.servlet.http.HttpServletRequest request) throws LoginException, javax.servlet.ServletException
Extracts the credentials from the given servlet request. Build aCredentials
object for the given authorization header. The creds may be used to login to the repository. If the specified header string isnull
the behaviour depends on thedefaultHeaderValue
field:
- if this field is
null
, a LoginException is thrown. This is suitable for clients (eg. webdav clients) for with sending a proper authorization header is not possible, if the server never send a 401. - if this an empty string, null-credentials are returned, thus forcing an null login on the repository
- if this field has a 'user:password' value, the respective simple credentials are generated.
If the request header is present but cannot be parsed a
ServletException
is thrown.- Specified by:
getCredentials
in interfaceCredentialsProvider
- Parameters:
request
- the servlet request- Returns:
- credentials or
null
. - Throws:
javax.servlet.ServletException
- If the Authorization header cannot be decoded.LoginException
- if no suitable auth header and missing-auth-mapping is not present
- if this field is
-
-