@Test public void authoritiesHaveLocalScopesWithoutAppIdPrefix() { String scopeWithNamespace = xsAppName + ".iot.Delete"; String scopeWithOtherAppId = "anyAppId!t200." + xsAppName + ".Delete"; Jwt jwt = new JwtGenerator() .addScopes(xsAppName + "." + scopeAdmin, scopeRead, scopeWithNamespace, scopeWithOtherAppId) .getToken(); AbstractAuthenticationToken authenticationToken = tokenConverterLocalScopesOnly.convert(jwt); assertThat(authenticationToken.getAuthorities().size(), is(3)); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority(scopeAdmin))); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority("iot.Delete"))); assertThat(authenticationToken.getAuthorities(), hasItem(new SimpleGrantedAuthority("Read"))); }
@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);  }