51 Map<String, Object> result = newLinkedHashMap();
52 OAuth2Authentication authentication = accessToken.getAuthenticationHolder().getAuthentication();
56 if (accessToken.getPermissions() != null && !accessToken.getPermissions().isEmpty()) {
58 Set<Object> permissions = Sets.newHashSet();
60 for (Permission perm : accessToken.getPermissions()) {
61 Map<String, Object> o = newLinkedHashMap();
62 o.put(
"resource_set_id", perm.getResourceSet().getId().toString());
63 Set<String> scopes = Sets.newHashSet(perm.getScopes());
64 o.put(
"scopes", scopes);
68 result.put(
"permissions", permissions);
71 Set<String> scopes = Sets.intersection(authScopes, accessToken.getScope());
77 if (accessToken.getExpiration() != null) {
80 result.put(
EXP, accessToken.getExpiration().getTime() / 1000L);
81 }
catch (ParseException e) {
82 logger.error(
"Parse exception in token introspection", e);
86 if (userInfo != null) {
88 result.put(
SUB, userInfo.getSub());
91 result.put(
SUB, authentication.getName());
94 if(authentication.getUserAuthentication() != null) {
95 result.put(
USER_ID, authentication.getUserAuthentication().getName());
98 result.put(
CLIENT_ID, authentication.getOAuth2Request().getClientId());
100 result.put(
TOKEN_TYPE, accessToken.getTokenType());
String SCOPE
Definition: IntrospectionResultAssembler.java:40
String SUB
Definition: IntrospectionResultAssembler.java:36
String CLIENT_ID
Definition: IntrospectionResultAssembler.java:34
String TOKEN_TYPE
Definition: IntrospectionResultAssembler.java:33
static final Logger logger
Definition: DefaultIntrospectionResultAssembler.java:46
String EXP
Definition: IntrospectionResultAssembler.java:37
String ACTIVE
Definition: IntrospectionResultAssembler.java:41
DateFormatter dateFormat
Definition: IntrospectionResultAssembler.java:42
String USER_ID
Definition: IntrospectionResultAssembler.java:35
String EXPIRES_AT
Definition: IntrospectionResultAssembler.java:38
String SCOPE_SEPARATOR
Definition: IntrospectionResultAssembler.java:39