@Path(value="/") @Consumes(value={"application/json","application/text","text/html","application/x-www-form-urlencoded"}) @Produces(value="application/json;charset=utf-8") public class WicketBasicSessionAuthService<U extends User,S extends BasicSession> extends AnyWebService implements ChangeGenerator<Object>
Cookie
authUserService
uses "wicketBasicSessionAuthService"
RequestCycle
for it. An example of this sequence:
RequestCycle
for thread: Ensure Application
is in the ThreadLocal
.
So ensure SiteWicketFilter.setupWicketContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
sets the Wicket Context.
By filter <init-param> set provideApplicationToPathPattern to include this endpoint#login(Principal)
(wicketBasicSessionAuthService) which is the backing service provider for the Auth Logic
applicationContext, CACHE, NO_CACHE, request, response
Constructor and Description |
---|
WicketBasicSessionAuthService() |
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener changeListener)
Allow Notify all
ChangeListener s about a change |
Function<U,Object> |
getAuthenticatedUserToResponseBody()
Define the response for a given
User |
AbstractSessionAuthService<User,S> |
getAuthUserService() |
List |
getListeners()
Get list directly.
|
Function<U,javax.ws.rs.core.NewCookie> |
getUserToCookie()
Session based Auth-Token (Cookie)
|
javax.ws.rs.core.Response |
login(BasicAuthPrincipal principal)
login.
|
javax.ws.rs.core.Response |
loginAjax(String json)
login for AJAX Post style request.
|
String |
logout() |
void |
notifyAllListeners(Object object)
Whenever a node is selected/updated, it also notifies its listeners.
|
void |
setAuthenticatedUserToResponseBody(Function<U,Object> authenticatedUserToResponseBody)
Define the response for a given
User |
void |
setAuthUserService(AbstractSessionAuthService<User,S> authUserService) |
void |
setListeners(List listeners)
Set list directly.
|
void |
setUserToCookie(Function<U,javax.ws.rs.core.NewCookie> userToCookie)
Session based Auth-Token (Cookie)
|
javax.ws.rs.core.Response |
testLogin(String userId,
String password) |
protected Runnable |
testSessionInvalidator(int seconds,
String userId,
javax.servlet.http.HttpServletRequest request)
A factory method to create a
Runnable to auto invalidate the session |
filter, getCacheDef, getTestString, query, query
@POST @Path(value="login") @Consumes(value={"application/json","application/x-www-form-urlencoded"}) @Produces(value="application/json") public javax.ws.rs.core.Response login(@FormParam(value="principal") BasicAuthPrincipal principal) throws Exception
RequestCycle
is setupprincipal
- as a Form FieldResponse
Exception
SiteWicketFilter}
,
WicketRequestCycleInterceptor}
@POST @Path(value="login-ajax") @Consumes(value="application/json") @Produces(value="application/json") public javax.ws.rs.core.Response loginAjax(String json) throws Exception
RequestCycle
is setupprincipal
- as JSON DATAResponse
Exception
SiteWicketFilter}
,
WicketRequestCycleInterceptor}
protected Runnable testSessionInvalidator(int seconds, String userId, javax.servlet.http.HttpServletRequest request)
Runnable
to auto invalidate the sessionseconds
- in int to wait before invlaidating the sessionuserId
- as Stringrequest
- as HttpRequest
Runnable
@GET @Path(value="test-login") @Consumes(value="text/html") @Produces(value="application/json") public javax.ws.rs.core.Response testLogin(@QueryParam(value="userId") String userId, @QueryParam(value="password") String password) throws Exception
Exception
@GET @Path(value="logout") public String logout()
public AbstractSessionAuthService<User,S> getAuthUserService()
public void setAuthUserService(AbstractSessionAuthService<User,S> authUserService)
public Function<U,javax.ws.rs.core.NewCookie> getUserToCookie()
user
- as User
type Cookie
public void setUserToCookie(Function<U,javax.ws.rs.core.NewCookie> userToCookie)
user
- as User
type public Function<U,Object> getAuthenticatedUserToResponseBody()
User
user
- as User
public void setAuthenticatedUserToResponseBody(Function<U,Object> authenticatedUserToResponseBody)
User
user
- as User
public void addChangeListener(ChangeListener changeListener)
ChangeGenerator
ChangeListener
s about a changeaddChangeListener
in interface ChangeGenerator<Object>
public void notifyAllListeners(Object object)
ChangeGenerator
notifyAllListeners
in interface ChangeGenerator<Object>
public List getListeners()
ChangeGenerator
getListeners
in interface ChangeGenerator<Object>
public void setListeners(List listeners)
ChangeGenerator
setListeners
in interface ChangeGenerator<Object>
Copyright © 2018. All rights reserved.