public class HooksContext extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HOOKS_KEY_SUBJECT_ACT_AS
hooks internal attribute key for grouper session
|
static String |
HOOKS_KEY_SUBJECT_LOGGED_IN
hooks internal attribute key for grouper session
|
static String |
KEY_HTTP_SERVLET_REQUEST
if application, key in context for request
|
static String |
KEY_HTTP_SERVLET_RESPONSE
if application, key in context for response
|
static String |
KEY_HTTP_SESSION
if application, key in context for session
|
Constructor and Description |
---|
HooksContext()
constructor
|
HooksContext(boolean theAsynchronous,
Map<String,Object> threadSafeAttributes,
Subject theAsynchronousGrouperSessionSubject,
String theAynchronousHookId)
constructor
|
Modifier and Type | Method and Description |
---|---|
Subject |
_internal_getAsynchronousGrouperSessionSubject()
keep track of grouper session subject if needed
|
boolean |
_internal_isAsynchronousGrouperSessionStarted()
if we started one, we should stop it
|
Map<String,Object> |
_internal_threadSafeAttributes()
look at all threadlocal attributes, and extract the names and values of the threadsafe ones.
|
static void |
assignSubjectActAs(Subject subject)
this will be a threadsafe attribute
|
static void |
assignSubjectLoggedIn(Subject subject)
this will be a threadsafe attribute
|
Set<String> |
attributeKeySet()
keys of attributes (all put together, global, threadlocal, local
|
static void |
clearThreadLocal()
clear out the threadlocal attributes at a point when everything should be clear
|
Subject |
getAsynchronousGrouperSessionSubject()
if this is an asynchronous hook, the grouper session subject is passed from
the other thread to this thread, this is that subject.
|
Object |
getAttribute(String key)
get an attribute
|
GrouperContextType |
getGrouperContextType()
get the context in which the hooks are running, e.g.
|
String |
getHookId()
keep a unique id to keep the logs straight
|
Subject |
getSubjectActAs()
current acting subject in app (if applicable), or just the current
subject
|
Subject |
getSubjectFromGrouperSession()
current user in the grouper session or null if none there
|
Subject |
getSubjectLoggedIn()
current user logged in to app (e.g.
|
GrouperSession |
grouperSession()
get the grouper session from the grouper session threadlocal
|
boolean |
isAsynchronous()
if this context is asynchronous
|
boolean |
isSubjectActAsInGroup(String groupName)
see if the current act as subject is in a certain group.
|
boolean |
isSubjectFromGrouperSessionInGroup(String groupName)
see if the current subject in grouper session is in a certain group (e.g.
|
static void |
setAttributeThreadLocal(String key,
Object value,
boolean okToCopyToNewThread)
set a threadlocal attribute
|
public static final String HOOKS_KEY_SUBJECT_LOGGED_IN
public static final String HOOKS_KEY_SUBJECT_ACT_AS
public static final String KEY_HTTP_SERVLET_RESPONSE
public static final String KEY_HTTP_SESSION
public static final String KEY_HTTP_SERVLET_REQUEST
public HooksContext()
public HooksContext(boolean theAsynchronous, Map<String,Object> threadSafeAttributes, Subject theAsynchronousGrouperSessionSubject, String theAynchronousHookId)
theAsynchronous
- true if this is in a new thread, false if notthreadSafeAttributes
- attributes from another thread if applicabletheAsynchronousGrouperSessionSubject
- if asynchronous, pass in who the grouper subject should betheAynchronousHookId
- if we are asynchronous, pass in what the hook id should bepublic Subject getSubjectLoggedIn()
public Subject getSubjectFromGrouperSession()
public Subject getSubjectActAs()
public GrouperSession grouperSession()
public Subject getAsynchronousGrouperSessionSubject()
public static void assignSubjectLoggedIn(Subject subject)
subject
- or null to clearpublic static void assignSubjectActAs(Subject subject)
subject
- or null to clearpublic boolean isSubjectActAsInGroup(String groupName)
groupName
- public boolean isSubjectFromGrouperSessionInGroup(String groupName)
groupName
- fully qualified group name to checkpublic Map<String,Object> _internal_threadSafeAttributes()
public GrouperContextType getGrouperContextType()
public static void setAttributeThreadLocal(String key, Object value, boolean okToCopyToNewThread)
key
- value
- okToCopyToNewThread
- if this should be set for hooks spawned in new threadpublic static void clearThreadLocal()
public Set<String> attributeKeySet()
public Object getAttribute(String key)
key
- public boolean isAsynchronous()
public Subject _internal_getAsynchronousGrouperSessionSubject()
public boolean _internal_isAsynchronousGrouperSessionStarted()
public String getHookId()
Copyright © 2016 Internet2. All rights reserved.