Class AbstractBasicHttpAuthenticatorFactory
- java.lang.Object
-
- org.springframework.extensions.webscripts.AbstractBasicHttpAuthenticatorFactory
-
- All Implemented Interfaces:
ServletAuthenticatorFactory
public abstract class AbstractBasicHttpAuthenticatorFactory extends java.lang.Object implements ServletAuthenticatorFactory
HTTP Basic AuthenticationAbstract class that makes basic authentication easier to handle by managing the request headers and the base 64 decoding.
Extend this class and implement doAuthenticate and doAuthorize to authenticate and authorize against a specific user store.
- Author:
- Erik Winlof
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classAbstractBasicHttpAuthenticatorFactory.BasicHttpAuthenticatorHTTP Basic Authentication
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringbasicRealmprotected java.lang.StringguestUserName
-
Constructor Summary
Constructors Constructor Description AbstractBasicHttpAuthenticatorFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Authenticatorcreate(WebScriptServletRequest req, WebScriptServletResponse res)Factory's create method.abstract booleandoAuthenticate(java.lang.String username, java.lang.String password)Implement to authenticate against a specific user store.abstract booleandoAuthorize(java.lang.String username, Description.RequiredAuthentication role)Implement to authorize against a specific user store.voidsetBasicRealm(java.lang.String basicRealm)The basic realm.voidsetGuestUserName(java.lang.String guestUserName)The guest username.
-
-
-
Method Detail
-
create
public Authenticator create(WebScriptServletRequest req, WebScriptServletResponse res)
Factory's create method.- Specified by:
createin interfaceServletAuthenticatorFactory- Parameters:
req- The webscript requestres- THe webscript response- Returns:
- A BasicHttpAuthenticator instance
-
doAuthenticate
public abstract boolean doAuthenticate(java.lang.String username, java.lang.String password)Implement to authenticate against a specific user store.- Parameters:
username- The usernamepassword- The password- Returns:
- Shall return true if authentication was successful
-
doAuthorize
public abstract boolean doAuthorize(java.lang.String username, Description.RequiredAuthentication role)Implement to authorize against a specific user store.- Parameters:
username- The usernamerole- The role that the user MUST have- Returns:
- Shall return true if the user has the given role
-
setGuestUserName
public void setGuestUserName(java.lang.String guestUserName)
The guest username.- Parameters:
guestUserName- The guest username
-
setBasicRealm
public void setBasicRealm(java.lang.String basicRealm)
The basic realm.- Parameters:
basicRealm- The basic realm
-
-