@Test public void extractCustomAuthoritiesWithScopes() { TokenAuthenticationConverter tokenConverterCustom = new TokenAuthenticationConverter( new MyAuthoritiesExtractor(xsAppName, "cost-center", "country")); Jwt jwt = new JwtGenerator() .addScopes(scopeAdmin) .addAttribute("cost-center", new String[] { "0815" }) .addAttribute("country", new String[] { "DE", "IL" }) .getToken(); AbstractAuthenticationToken authenticationToken = tokenConverterCustom.convert(jwt); assertThat(authenticationToken.getAuthorities().size(), is(4)); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority("ATTR:COST-CENTER=0815"))); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority("ATTR:COUNTRY=DE"))); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority("ATTR:COUNTRY=IL"))); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority(scopeAdmin))); }
@Override public AbstractAuthenticationToken convert(Jwt jwt) { return new AuthenticationToken(jwt, authoritiesExtractor.getAuthorities(new XsuaaToken(jwt))); }
TokenAuthenticationConverter implements Converter<Jwt, AbstractAuthenticationToken> { @Override public AbstractAuthenticationToken convert(Jwt jwt) { return new AuthenticationToken(jwt, authoritiesExtractor.getAuthorities(new XsuaaToken(jwt))); } }
TokenAuthenticationConverter implements Converter<Jwt, AbstractAuthenticationToken> { @Override public AbstractAuthenticationToken convert(Jwt jwt) { return new AuthenticationToken(jwt, authoritiesExtractor.getAuthorities(new XsuaaToken(jwt))); } TokenAuthenticationConverter(AuthoritiesExtractor authoritiesExtractor);  TokenAuthenticationConverter(String appId);  TokenAuthenticationConverter(XsuaaServiceConfiguration xsuaaServiceConfiguration); }
TokenAuthenticationConverter implements Converter<Jwt, AbstractAuthenticationToken> { @Override public AbstractAuthenticationToken convert(Jwt jwt) { return new AuthenticationToken(jwt, authoritiesExtractor.getAuthorities(new XsuaaToken(jwt))); } TokenAuthenticationConverter(AuthoritiesExtractor authoritiesExtractor);  TokenAuthenticationConverter(String appId);  TokenAuthenticationConverter(XsuaaServiceConfiguration xsuaaServiceConfiguration); @Override AbstractAuthenticationToken convert(Jwt jwt); TokenAuthenticationConverter setLocalScopeAsAuthorities(boolean extractLocalScopesOnly); }
TokenAuthenticationConverter implements Converter<Jwt, AbstractAuthenticationToken> { @Override public AbstractAuthenticationToken convert(Jwt jwt) { return new AuthenticationToken(jwt, authoritiesExtractor.getAuthorities(new XsuaaToken(jwt))); } TokenAuthenticationConverter(AuthoritiesExtractor authoritiesExtractor);  TokenAuthenticationConverter(String appId);  TokenAuthenticationConverter(XsuaaServiceConfiguration xsuaaServiceConfiguration); @Override AbstractAuthenticationToken convert(Jwt jwt); TokenAuthenticationConverter setLocalScopeAsAuthorities(boolean extractLocalScopesOnly);  }