private AccessTokenConverter accessTokenConverter() { if (this.accessTokenConverter == null) { accessTokenConverter = new DefaultAccessTokenConverter(); } return this.accessTokenConverter; }
@Override public OAuth2Authentication extractAuthentication(Map<String, ?> map) { return super.extractAuthentication(map); } }
/** * The class used to covert access tokens to authentications in Spring Security. * * @param userAuthenticationConverter The user converter to use * @return A DefaultAccessTokenConverter with the ping federate user authentication converter class used */ @Bean public DefaultAccessTokenConverter defaultAccessTokenConverter( @NotNull final UserAuthenticationConverter userAuthenticationConverter ) { final DefaultAccessTokenConverter converter = new DefaultAccessTokenConverter(); converter.setUserTokenConverter(userAuthenticationConverter); return converter; }
@Bean public JwtAccessTokenConverter jwtAccessTokenConverter() throws Exception { final DefaultAccessTokenConverter defaultAccessTokenConverter = new DefaultAccessTokenConverter(); defaultAccessTokenConverter.setIncludeGrantType(true); final JwtAccessTokenConverter jwtAccessTokenConverter = new JwtAccessTokenConverter(); jwtAccessTokenConverter.setAccessTokenConverter(defaultAccessTokenConverter); jwtAccessTokenConverter.setVerifierKey(resourceServerProperties().getJwt().getKeyValue()); jwtAccessTokenConverter.afterPropertiesSet(); return jwtAccessTokenConverter; }
@Override public Map<String, ?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) { Map response = super.convertAccessToken(token, authentication); response.put( ISS, Optional.ofNullable(issuerSupplier) .map(Supplier::get) .orElse(WIDEREST_ISS) ); return response; }
@Autowired @Override public void setUserTokenConverter(UserAuthenticationConverter userTokenConverter) { super.setUserTokenConverter(userTokenConverter); }
@Override public OAuth2AccessToken extractAccessToken(String value, Map<String, ?> map) { return super.extractAccessToken(value, map); }
@Override public OAuth2Authentication extractAuthentication(Map<String, ?> map) { Map<String, Object> claims = new HashMap<>(); claims.putAll(map); claims.put(UserAuthenticationConverter.USERNAME, map.get("prn")); return super.extractAuthentication(claims); } }
@Bean public AccessTokenConverter accessTokenConverter() { DefaultAccessTokenConverter converter = new DefaultAccessTokenConverter(); converter.setUserTokenConverter(userTokenConverter()); return converter; }
@Override public Map<String, ?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) { Map<String,Object> map = (Map<String, Object>) super.convertAccessToken(token, authentication); Object details = authentication.getPrincipal(); if(details instanceof CustomUserDetails){ CustomUserDetails user = (CustomUserDetails)userDetailsService .loadUserByUsername(((CustomUserDetails) details).getUsername()); map.put("userId",user.getUserId().toString()); map.put("language", user.getLanguage()); map.put("timeZone", user.getTimeZone()); map.put("email", user.getEmail()); map.put("organizationId", user.getOrganizationId().toString()); if(user.getAdditionInfo() != null){ map.put("additionInfo", user.getAdditionInfo()); } }else if(details instanceof String){ CustomClientDetails client = (CustomClientDetails) clientDetailsService .loadClientByClientId((String) details); map.put("organizationId", client.getOrganizationId()); if(client.getAdditionalInformation() != null){ map.put("additionInfo", client.getAdditionalInformation()); } } return map; }
@Override public OAuth2AccessToken extractAccessToken(String value, Map<String, ?> map) { return super.extractAccessToken(value, tweakScopeMap(map)); }
@Override public OAuth2Authentication extractAuthentication(Map<String, ?> claims) { OAuth2Authentication authentication = super.extractAuthentication(claims); authentication.setDetails(claims); return authentication; }
private AccessTokenConverter accessTokenConverter() { if (this.accessTokenConverter == null) { accessTokenConverter = new DefaultAccessTokenConverter(); } return this.accessTokenConverter; }
public Map<String, ?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) { Map<String, Object> map = (Map<String, Object>) super.convertAccessToken(token, authentication); Object details = authentication.getPrincipal(); if (details instanceof CustomUserDetails) {
@Override public OAuth2Authentication extractAuthentication(Map<String, ?> map) { return super.extractAuthentication(tweakScopeMap(map)); }
@Bean public DefaultAccessTokenConverter defaultAccessTokenConverter() { return new DefaultAccessTokenConverter(); }
public Map<String, ?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication) { Map<String, Object> map = (Map<String, Object>) super.convertAccessToken(token, authentication); Object details = authentication.getPrincipal(); if (details instanceof CustomUserDetails) {
((Map<String, Object>)map).put("user_name",((Map<String, Object>)map).get("username")); OAuth2Authentication authentication = super.extractAuthentication(map); if(map.containsKey("userId")){ CustomUserDetails user = new CustomUserDetails(authentication.getName(),
@Bean public AccessTokenConverter accessTokenConverter() { return new DefaultAccessTokenConverter(); }
((Map<String, Object>) map).put("user_name", ((Map<String, Object>) map).get("username")); OAuth2Authentication authentication = super.extractAuthentication(map); if (map.containsKey(USER_ID)) { CustomUserDetails user = new CustomUserDetails(authentication.getName(),