|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.sakaiproject.hybrid.util.NakamuraAuthenticationHelper
public class NakamuraAuthenticationHelper
Useful helper for interacting with Nakamura's authentication REST end-points. Note: thread safe.
| Nested Class Summary | |
|---|---|
static class |
NakamuraAuthenticationHelper.AuthInfo
Static final class for storing cached results from Nakamura lookup. |
static class |
NakamuraAuthenticationHelper.DefaultHttpClientProvider
Implementation is thread safe. |
static interface |
NakamuraAuthenticationHelper.HttpClientProvider
A simple abstraction to allow for unit testing of NakamuraAuthenticationHelper. |
| Field Summary | |
|---|---|
static String |
CONFIG_ANONYMOUS
sakai.properties The name of the nakamura anonymous principal. |
static String |
CONFIG_COOKIE_NAME
sakai.properties The name of the cookie that is set by nakamura. |
static String |
CONFIG_PREFIX
All sakai.properties settings will be prefixed with this string. |
protected String |
hostname
The hostname we will use to lookup the sharedSecret for access to validateUrl. |
protected NakamuraAuthenticationHelper.HttpClientProvider |
httpClientProvider
A simple abstraction to allow for proper unit testing |
protected String |
principal
The nakamura user that has permissions to GET /var/cluster/user.cookie.json. |
protected org.sakaiproject.component.api.ServerConfigurationService |
serverConfigurationService
|
protected static String |
THREAD_LOCAL_CACHE_KEY
The key that will be used to cache AuthInfo hits in ThreadLocal. |
protected org.sakaiproject.thread_local.api.ThreadLocalManager |
threadLocalManager
|
protected String |
validateUrl
The Nakamura RESTful service to validate authenticated users. |
protected XSakaiToken |
xSakaiToken
|
| Constructor Summary | |
|---|---|
NakamuraAuthenticationHelper(org.sakaiproject.component.api.ComponentManager componentManager,
String validateUrl,
String principal,
String hostname)
Class is immutable and thread safe. |
|
| Method Summary | |
|---|---|
NakamuraAuthenticationHelper.AuthInfo |
getPrincipalLoggedIntoNakamura(javax.servlet.http.HttpServletRequest request)
Calls Nakamura to determine the identity of the current user. |
protected String |
getSecret(javax.servlet.http.HttpServletRequest request)
Gets the authentication key from SAKAI-TRACKING cookie. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONFIG_PREFIX
public static final String CONFIG_ANONYMOUS
public static final String CONFIG_COOKIE_NAME
protected static final String THREAD_LOCAL_CACHE_KEY
protected transient String validateUrl
protected transient String principal
protected transient String hostname
protected transient NakamuraAuthenticationHelper.HttpClientProvider httpClientProvider
protected transient org.sakaiproject.thread_local.api.ThreadLocalManager threadLocalManager
protected transient org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService
protected transient XSakaiToken xSakaiToken
| Constructor Detail |
|---|
public NakamuraAuthenticationHelper(org.sakaiproject.component.api.ComponentManager componentManager,
String validateUrl,
String principal,
String hostname)
validateUrl - The Nakamura REST end-point we will use to validate the
cookie.principal - The principal that will be used when connecting to Nakamura
REST end-point. Must have permissions to read
/var/cluster/user.cookie.json.hostname - The hostname we will use to lookup the sharedSecret for access
to validateUrl
IllegalArgumentException
IllegalStateException| Method Detail |
|---|
public NakamuraAuthenticationHelper.AuthInfo getPrincipalLoggedIntoNakamura(javax.servlet.http.HttpServletRequest request)
request -
IllegalArgumentException
IllegalStateException - For all unexpected cause Exceptions.protected String getSecret(javax.servlet.http.HttpServletRequest request)
request -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||