public abstract class LoginEndpoint extends RestEndpoint
LogoutEndpoint,
AuthenticatedRequestHandleruri| Constructor and Description |
|---|
LoginEndpoint(java.lang.String uri,
SessionAuthenticator authenticator)
Constructs the endpoint at given URI.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract HTTPResponse |
failedLoginResponse(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Constructs the response upon failed login.
|
HTTPResponse |
get(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Handles
GET request on this endpoint. |
protected abstract java.lang.String |
login(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Checks the credentials in the request.
|
protected HTTPResponse |
onSuccessfulLogin(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String username,
java.lang.String sessionID)
Handles the login and send the appropriate response.
|
HTTPResponse |
put(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Handles
PUT request on this endpoint. |
protected abstract HTTPResponse |
successfulLoginResponse(HTTPRequest request,
java.util.Map<java.lang.String,java.lang.String> attributes)
Constructs the response upon successful login.
|
delete, getURI, isGlobal, postpublic LoginEndpoint(java.lang.String uri,
SessionAuthenticator authenticator)
uri - the URI of the RestEndpoint.authenticator - the SessionAuthenticator used to login users.public HTTPResponse get(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
RestEndpointGET request on this endpoint.
Default implementation return a status code 501
get in class RestEndpointrequest - the request to handle.attributes - the attributes populated by the request processing.public HTTPResponse put(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
RestEndpointPUT request on this endpoint.
Default implementation return a status code 501
put in class RestEndpointrequest - the request to handle.attributes - the attributes populated by the request processing.protected abstract java.lang.String login(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
request - the HTTPRequest.attributes - the attributes populated by the request processing.null if login failed.protected abstract HTTPResponse successfulLoginResponse(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
request - the HTTPRequest.attributes - the attributes populated by the request processing.protected abstract HTTPResponse failedLoginResponse(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes)
request - the HTTPRequest.attributes - the attributes populated by the request processing.protected HTTPResponse onSuccessfulLogin(HTTPRequest request, java.util.Map<java.lang.String,java.lang.String> attributes, java.lang.String username, java.lang.String sessionID)
request - the HTTPRequest.attributes - the attributes populated by the request processing.username - the username of the logged in user.sessionID - the sessionID of the new session.