keycloak-scim/securing_apps/topics/oidc/java/adapter-context.adoc

21 lines
700 B
Text
Raw Normal View History

2016-06-09 13:12:10 +00:00
==== Security Context
2016-04-18 19:10:32 +00:00
2016-06-03 10:35:36 +00:00
The `KeycloakSecurityContext` interface is available if you need to access to the tokens directly. This could be useful if you want to retrieve additional
2017-08-28 12:50:14 +00:00
details from the token (such as user profile information) or you want to invoke a RESTful service that is protected by {project_name}.
2016-04-18 19:10:32 +00:00
2016-06-03 10:35:36 +00:00
In servlet environments it is available in secured invocations as an attribute in HttpServletRequest:
[source,java]
----
httpServletRequest
.getAttribute(KeycloakSecurityContext.class.getName());
----
Or, it is available in insecured requests in the HttpSession:
2016-06-03 10:35:36 +00:00
[source,java]
----
httpServletRequest.getSession()
.getAttribute(KeycloakSecurityContext.class.getName());
2016-04-18 19:10:32 +00:00
----