org.apache.cocoon.shiro.rest
Class AbstractShiroLogin

java.lang.Object
  extended by org.apache.cocoon.shiro.rest.AbstractShiroLogin
All Implemented Interfaces:
Get, Post
Direct Known Subclasses:
LoginUser

public abstract class AbstractShiroLogin
extends Object
implements Post, Get


Field Summary
protected static org.slf4j.Logger LOG
           
protected  String LOGIN_ATTEMPTS_COUNTER
           
protected  String LOGIN_ATTEMPTS_EXCEEDED
           
protected  String to
           
 
Constructor Summary
AbstractShiroLogin()
           
 
Method Summary
 RestResponse doGet()
           
 RestResponse doPost()
           
protected  Integer getAllowedWrongAttempts()
          Gets the number of maximum allowed wrong login attempts.
protected abstract  String getDefaultTo()
           
protected abstract  String getErrorLogin()
           
protected  RestResponse getErrorResponse(Map<String,Object> data)
           
protected abstract  RestResponse getLoginPage(Map<String,Object> data)
           
protected  RestResponse getSuccessResponse()
           
protected  String getTo()
           
protected  boolean isAttemptsExceeded(org.apache.shiro.subject.Subject subject)
          Checks if login attempts exceeded allowed wrong attempts.
protected  Map<String,Object> validatePreLogin()
          A validation method that is invoked before initiating login.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_ATTEMPTS_EXCEEDED

protected final String LOGIN_ATTEMPTS_EXCEEDED
See Also:
Constant Field Values

LOGIN_ATTEMPTS_COUNTER

protected final String LOGIN_ATTEMPTS_COUNTER
See Also:
Constant Field Values

to

protected String to

LOG

protected static final org.slf4j.Logger LOG
Constructor Detail

AbstractShiroLogin

public AbstractShiroLogin()
Method Detail

getErrorLogin

protected abstract String getErrorLogin()

getDefaultTo

protected abstract String getDefaultTo()

getLoginPage

protected abstract RestResponse getLoginPage(Map<String,Object> data)
                                      throws Exception
Throws:
Exception

doPost

public RestResponse doPost()
                    throws Exception
Specified by:
doPost in interface Post
Throws:
Exception

isAttemptsExceeded

protected boolean isAttemptsExceeded(org.apache.shiro.subject.Subject subject)
Checks if login attempts exceeded allowed wrong attempts.

Parameters:
subject - the shiro subject
Returns:
true, if login attempts exceeded

getAllowedWrongAttempts

protected Integer getAllowedWrongAttempts()
Gets the number of maximum allowed wrong login attempts.

Returns:
the allowed wrong attempts count

validatePreLogin

protected Map<String,Object> validatePreLogin()
A validation method that is invoked before initiating login. If this method returns a non-empty map, then login is skipped and map data is added to UrlResponse. It can be overridden in extending classes to perform validations before login like captcha.

Returns:
the data map that will be passed to error URL Rest response

getSuccessResponse

protected RestResponse getSuccessResponse()

getErrorResponse

protected RestResponse getErrorResponse(Map<String,Object> data)
                                 throws MalformedURLException
Throws:
MalformedURLException

doGet

public RestResponse doGet()
                   throws Exception
Specified by:
doGet in interface Get
Throws:
Exception

getTo

protected String getTo()


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.