public final class OAuth20Utils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
casOAuthCallbackUrl(java.lang.String serverPrefixUrl)
Cas oauth callback url.
|
static org.apereo.cas.support.oauth.services.OAuthRegisteredService |
getRegisteredOAuthService(org.apereo.cas.services.ServicesManager servicesManager,
java.lang.String clientId)
Locate the requested instance of
OAuthRegisteredService by the given clientId. |
static java.util.Collection<java.lang.String> |
getRequestedScopes(javax.servlet.http.HttpServletRequest context)
Gets requested scopes.
|
static java.util.Collection<java.lang.String> |
getRequestedScopes(org.pac4j.core.context.J2EContext context)
Gets requested scopes.
|
static java.util.Map<java.lang.String,java.lang.Object> |
getRequestParameters(java.util.Collection<java.lang.String> attributes,
javax.servlet.http.HttpServletRequest context)
Gets attributes.
|
static boolean |
isGrantType(java.lang.String type,
OAuth20GrantTypes expectedType)
Check the grant type against an expected grant type.
|
static boolean |
isResponseType(java.lang.String type,
OAuth20ResponseTypes expectedType)
Check the response type against an expected response type.
|
static java.lang.String |
jsonify(java.util.Map map)
Jsonify string.
|
static org.springframework.web.servlet.ModelAndView |
produceErrorView(java.lang.Exception e)
Produce error view model and view.
|
static org.springframework.web.servlet.ModelAndView |
produceUnauthorizedErrorView()
Produce unauthorized error view model and view.
|
static org.springframework.web.servlet.ModelAndView |
redirectTo(java.lang.String url)
Return a view which is a redirection to an url.
|
static org.springframework.web.servlet.ModelAndView |
writeText(javax.servlet.http.HttpServletResponse response,
java.lang.String text,
int status)
Write to the output the text and return a null view.
|
static org.springframework.web.servlet.ModelAndView |
writeTextError(javax.servlet.http.HttpServletResponse response,
java.lang.String error)
Write to the output this error text and return a null view.
|
public static org.springframework.web.servlet.ModelAndView writeTextError(javax.servlet.http.HttpServletResponse response,
java.lang.String error)
response - http responseerror - error messagepublic static org.springframework.web.servlet.ModelAndView writeText(javax.servlet.http.HttpServletResponse response,
java.lang.String text,
int status)
response - http responsetext - output textstatus - status codepublic static org.springframework.web.servlet.ModelAndView redirectTo(java.lang.String url)
url - redirect urlpublic static org.apereo.cas.support.oauth.services.OAuthRegisteredService getRegisteredOAuthService(org.apereo.cas.services.ServicesManager servicesManager,
java.lang.String clientId)
OAuthRegisteredService by the given clientId.servicesManager - the service registry DAO instance.clientId - the client id by which the OAuthRegisteredService is to be located.OAuthRegisteredService instance in the service registry.public static java.util.Map<java.lang.String,java.lang.Object> getRequestParameters(java.util.Collection<java.lang.String> attributes,
javax.servlet.http.HttpServletRequest context)
attributes - the attributescontext - the contextpublic static java.util.Collection<java.lang.String> getRequestedScopes(org.pac4j.core.context.J2EContext context)
context - the contextpublic static java.util.Collection<java.lang.String> getRequestedScopes(javax.servlet.http.HttpServletRequest context)
context - the contextpublic static org.springframework.web.servlet.ModelAndView produceUnauthorizedErrorView()
public static org.springframework.web.servlet.ModelAndView produceErrorView(java.lang.Exception e)
e - the epublic static java.lang.String casOAuthCallbackUrl(java.lang.String serverPrefixUrl)
serverPrefixUrl - the server prefix urlpublic static java.lang.String jsonify(java.util.Map map)
map - the mappublic static boolean isGrantType(java.lang.String type,
OAuth20GrantTypes expectedType)
type - the given grant typeexpectedType - the expected grant typepublic static boolean isResponseType(java.lang.String type,
OAuth20ResponseTypes expectedType)
type - the given response typeexpectedType - the expected response type