refactor: 💡 Code inspection by IDEA
parent
1056d6acdc
commit
2b94aff58e
|
@ -48,10 +48,10 @@ import org.springframework.util.StringUtils;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ClientKeyCacheService {
|
public class ClientKeyCacheService {
|
||||||
|
|
||||||
private JWKSetCacheService jwksUriCache;
|
private final JWKSetCacheService jwksUriCache;
|
||||||
private SymmetricKeyJWTValidatorCacheService symmetricCache;
|
private final SymmetricKeyJWTValidatorCacheService symmetricCache;
|
||||||
private LoadingCache<JWKSet, JWTSigningAndValidationService> jwksValidators;
|
private final LoadingCache<JWKSet, JWTSigningAndValidationService> jwksValidators;
|
||||||
private LoadingCache<JWKSet, JWTEncryptionAndDecryptionService> jwksEncrypters;
|
private final LoadingCache<JWKSet, JWTEncryptionAndDecryptionService> jwksEncrypters;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClientKeyCacheService(JWKSetCacheService jwksUriCache, SymmetricKeyJWTValidatorCacheService symmetricCache) {
|
public ClientKeyCacheService(JWKSetCacheService jwksUriCache, SymmetricKeyJWTValidatorCacheService symmetricCache) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.springframework.util.StringUtils;
|
||||||
@Converter
|
@Converter
|
||||||
public class JsonElementStringConverter implements AttributeConverter<JsonElement, String> {
|
public class JsonElementStringConverter implements AttributeConverter<JsonElement, String> {
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertToDatabaseColumn(JsonElement attribute) {
|
public String convertToDatabaseColumn(JsonElement attribute) {
|
||||||
|
|
|
@ -24,21 +24,21 @@ import org.springframework.security.oauth2.provider.ClientDetailsService;
|
||||||
|
|
||||||
public interface ClientDetailsEntityService extends ClientDetailsService {
|
public interface ClientDetailsEntityService extends ClientDetailsService {
|
||||||
|
|
||||||
public ClientDetailsEntity saveNewClient(ClientDetailsEntity client);
|
ClientDetailsEntity saveNewClient(ClientDetailsEntity client);
|
||||||
|
|
||||||
public ClientDetailsEntity getClientById(Long id);
|
ClientDetailsEntity getClientById(Long id);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ClientDetailsEntity loadClientByClientId(String clientId) throws OAuth2Exception;
|
ClientDetailsEntity loadClientByClientId(String clientId) throws OAuth2Exception;
|
||||||
|
|
||||||
public void deleteClient(ClientDetailsEntity client);
|
void deleteClient(ClientDetailsEntity client);
|
||||||
|
|
||||||
public ClientDetailsEntity updateClient(ClientDetailsEntity oldClient, ClientDetailsEntity newClient);
|
ClientDetailsEntity updateClient(ClientDetailsEntity oldClient, ClientDetailsEntity newClient);
|
||||||
|
|
||||||
public Collection<ClientDetailsEntity> getAllClients();
|
Collection<ClientDetailsEntity> getAllClients();
|
||||||
|
|
||||||
public ClientDetailsEntity generateClientId(ClientDetailsEntity client);
|
ClientDetailsEntity generateClientId(ClientDetailsEntity client);
|
||||||
|
|
||||||
public ClientDetailsEntity generateClientSecret(ClientDetailsEntity client);
|
ClientDetailsEntity generateClientSecret(ClientDetailsEntity client);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.springframework.stereotype.Service;
|
||||||
@Service("clientUserDetailsService")
|
@Service("clientUserDetailsService")
|
||||||
public class DefaultClientUserDetailsService implements UserDetailsService {
|
public class DefaultClientUserDetailsService implements UserDetailsService {
|
||||||
|
|
||||||
private static GrantedAuthority ROLE_CLIENT = new SimpleGrantedAuthority("ROLE_CLIENT");
|
private static final GrantedAuthority ROLE_CLIENT = new SimpleGrantedAuthority("ROLE_CLIENT");
|
||||||
|
|
||||||
private ClientDetailsEntityService clientDetailsService;
|
private ClientDetailsEntityService clientDetailsService;
|
||||||
private final ConfigurationPropertiesBean config;
|
private final ConfigurationPropertiesBean config;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class DefaultDeviceCodeService implements DeviceCodeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceCodeRepository repository;
|
private DeviceCodeRepository repository;
|
||||||
|
|
||||||
private RandomValueStringGenerator randomGenerator = new RandomValueStringGenerator();
|
private final RandomValueStringGenerator randomGenerator = new RandomValueStringGenerator();
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see cz.muni.ics.oauth2.service.DeviceCodeService#save(cz.muni.ics.oauth2.model.DeviceCode)
|
* @see cz.muni.ics.oauth2.service.DeviceCodeService#save(cz.muni.ics.oauth2.model.DeviceCode)
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class DefaultOAuth2AuthorizationCodeService implements AuthorizationCodeS
|
||||||
|
|
||||||
private int authCodeExpirationSeconds = 60 * 5; // expire in 5 minutes by default
|
private int authCodeExpirationSeconds = 60 * 5; // expire in 5 minutes by default
|
||||||
|
|
||||||
private RandomValueStringGenerator generator = new RandomValueStringGenerator(22);
|
private final RandomValueStringGenerator generator = new RandomValueStringGenerator(22);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a random authorization code and create an AuthorizationCodeEntity,
|
* Generate a random authorization code and create an AuthorizationCodeEntity,
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
|
||||||
private ConfigurationPropertiesBean config;
|
private ConfigurationPropertiesBean config;
|
||||||
|
|
||||||
// map of sector URI -> list of redirect URIs
|
// map of sector URI -> list of redirect URIs
|
||||||
private LoadingCache<String, List<String>> sectorRedirects = CacheBuilder.newBuilder()
|
private final LoadingCache<String, List<String>> sectorRedirects = CacheBuilder.newBuilder()
|
||||||
.expireAfterAccess(1, TimeUnit.HOURS)
|
.expireAfterAccess(1, TimeUnit.HOURS)
|
||||||
.maximumSize(100)
|
.maximumSize(100)
|
||||||
.build(new SectorIdentifierLoader(HttpClientBuilder.create().useSystemProperties().build()));
|
.build(new SectorIdentifierLoader(HttpClientBuilder.create().useSystemProperties().build()));
|
||||||
|
@ -318,7 +318,7 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
|
||||||
* Get the client for the given ClientID
|
* Get the client for the given ClientID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ClientDetailsEntity loadClientByClientId(String clientId) throws OAuth2Exception, InvalidClientException, IllegalArgumentException {
|
public ClientDetailsEntity loadClientByClientId(String clientId) throws OAuth2Exception, IllegalArgumentException {
|
||||||
if (!Strings.isNullOrEmpty(clientId)) {
|
if (!Strings.isNullOrEmpty(clientId)) {
|
||||||
ClientDetailsEntity client = clientRepository.getClientByClientId(clientId);
|
ClientDetailsEntity client = clientRepository.getClientByClientId(clientId);
|
||||||
if (client == null) {
|
if (client == null) {
|
||||||
|
@ -446,9 +446,9 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private class SectorIdentifierLoader extends CacheLoader<String, List<String>> {
|
private class SectorIdentifierLoader extends CacheLoader<String, List<String>> {
|
||||||
private HttpComponentsClientHttpRequestFactory httpFactory;
|
private final HttpComponentsClientHttpRequestFactory httpFactory;
|
||||||
private RestTemplate restTemplate;
|
private final RestTemplate restTemplate;
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
SectorIdentifierLoader(HttpClient httpClient) {
|
SectorIdentifierLoader(HttpClient httpClient) {
|
||||||
this.httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
this.httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
|
||||||
|
|
|
@ -44,28 +44,28 @@ public class DefaultSystemScopeService implements SystemScopeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemScopeRepository repository;
|
private SystemScopeRepository repository;
|
||||||
|
|
||||||
private Predicate<SystemScope> isDefault = new Predicate<SystemScope>() {
|
private final Predicate<SystemScope> isDefault = new Predicate<SystemScope>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(SystemScope input) {
|
public boolean apply(SystemScope input) {
|
||||||
return (input != null && input.isDefaultScope());
|
return (input != null && input.isDefaultScope());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Predicate<SystemScope> isRestricted = new Predicate<SystemScope>() {
|
private final Predicate<SystemScope> isRestricted = new Predicate<SystemScope>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(SystemScope input) {
|
public boolean apply(SystemScope input) {
|
||||||
return (input != null && input.isRestricted());
|
return (input != null && input.isRestricted());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Predicate<SystemScope> isReserved = new Predicate<SystemScope>() {
|
private final Predicate<SystemScope> isReserved = new Predicate<SystemScope>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(SystemScope input) {
|
public boolean apply(SystemScope input) {
|
||||||
return (input != null && getReserved().contains(input));
|
return (input != null && getReserved().contains(input));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Function<String, SystemScope> stringToSystemScope = new Function<String, SystemScope>() {
|
private final Function<String, SystemScope> stringToSystemScope = new Function<String, SystemScope>() {
|
||||||
@Override
|
@Override
|
||||||
public SystemScope apply(String input) {
|
public SystemScope apply(String input) {
|
||||||
if (Strings.isNullOrEmpty(input)) {
|
if (Strings.isNullOrEmpty(input)) {
|
||||||
|
@ -83,7 +83,7 @@ public class DefaultSystemScopeService implements SystemScopeService {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private Function<SystemScope, String> systemScopeToString = new Function<SystemScope, String>() {
|
private final Function<SystemScope, String> systemScopeToString = new Function<SystemScope, String>() {
|
||||||
@Override
|
@Override
|
||||||
public String apply(SystemScope input) {
|
public String apply(SystemScope input) {
|
||||||
if (input == null) {
|
if (input == null) {
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.springframework.web.util.UriUtils;
|
||||||
@Service("uriEncodedClientUserDetailsService")
|
@Service("uriEncodedClientUserDetailsService")
|
||||||
public class UriEncodedClientUserDetailsService implements UserDetailsService {
|
public class UriEncodedClientUserDetailsService implements UserDetailsService {
|
||||||
|
|
||||||
private static GrantedAuthority ROLE_CLIENT = new SimpleGrantedAuthority("ROLE_CLIENT");
|
private static final GrantedAuthority ROLE_CLIENT = new SimpleGrantedAuthority("ROLE_CLIENT");
|
||||||
|
|
||||||
private ClientDetailsEntityService clientDetailsService;
|
private ClientDetailsEntityService clientDetailsService;
|
||||||
private final ConfigurationPropertiesBean config;
|
private final ConfigurationPropertiesBean config;
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class ChainedTokenGranter extends AbstractTokenGranter {
|
||||||
public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant_type:redelegate";
|
public static final String GRANT_TYPE = "urn:ietf:params:oauth:grant_type:redelegate";
|
||||||
|
|
||||||
// keep down-cast versions so we can get to the right queries
|
// keep down-cast versions so we can get to the right queries
|
||||||
private OAuth2TokenEntityService tokenServices;
|
private final OAuth2TokenEntityService tokenServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tokenServices
|
* @param tokenServices
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class TokenApiView extends AbstractView {
|
||||||
|
|
||||||
public static final String VIEWNAME = "tokenApiView";
|
public static final String VIEWNAME = "tokenApiView";
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.setExclusionStrategies(new ExclusionStrategy() {
|
.setExclusionStrategies(new ExclusionStrategy() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -57,10 +57,7 @@ public class TokenApiView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class OAuthConfirmationController {
|
||||||
uriBuilder.addParameter("state", authRequest.getState()); // copy the state parameter if one was given
|
uriBuilder.addParameter("state", authRequest.getState()); // copy the state parameter if one was given
|
||||||
}
|
}
|
||||||
|
|
||||||
return "redirect:" + uriBuilder.toString();
|
return "redirect:" + uriBuilder;
|
||||||
|
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
log.error("Can't build redirect URI for prompt=none, sending error instead", e);
|
log.error("Can't build redirect URI for prompt=none, sending error instead", e);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class ScopeAPI {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemScopeService scopeService;
|
private SystemScopeService scopeService;
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
@RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public String getAll(ModelMap m) {
|
public String getAll(ModelMap m) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ public abstract class PerunAttributeValueAwareModel {
|
||||||
|
|
||||||
private InconvertibleValueException inconvertible(String clazzName) {
|
private InconvertibleValueException inconvertible(String clazzName) {
|
||||||
return new InconvertibleValueException("Cannot convert value of attribute to " + clazzName +
|
return new InconvertibleValueException("Cannot convert value of attribute to " + clazzName +
|
||||||
" for object: " + this.toString());
|
" for object: " + this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PerunSamlAuthenticationSuccessHandler extends SavedRequestAwareAuth
|
||||||
.map(AuthnContext::getAuthnContextClassRef)
|
.map(AuthnContext::getAuthnContextClassRef)
|
||||||
.map(AuthnContextClassRef::getAuthnContextClassRef)
|
.map(AuthnContextClassRef::getAuthnContextClassRef)
|
||||||
.collect(Collectors.joining());
|
.collect(Collectors.joining());
|
||||||
request.getSession(true).setAttribute(PerunOIDCTokenService.SESSION_PARAM_ACR, acrs);;
|
request.getSession(true).setAttribute(PerunOIDCTokenService.SESSION_PARAM_ACR, acrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,9 +565,9 @@ public class GA4GHClaimSource extends ClaimSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ClaimRepository {
|
public static class ClaimRepository {
|
||||||
private String name;
|
private final String name;
|
||||||
private RestTemplate restTemplate;
|
private final RestTemplate restTemplate;
|
||||||
private String actionURL;
|
private final String actionURL;
|
||||||
|
|
||||||
public ClaimRepository(String name, RestTemplate restTemplate, String actionURL) {
|
public ClaimRepository(String name, RestTemplate restTemplate, String actionURL) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -27,9 +27,9 @@ public class PerunFiltersContext {
|
||||||
private static final String FILTER_CLASS = ".class";
|
private static final String FILTER_CLASS = ".class";
|
||||||
private static final String PREFIX = "filter.";
|
private static final String PREFIX = "filter.";
|
||||||
|
|
||||||
private List<PerunRequestFilter> filters;
|
private final List<PerunRequestFilter> filters;
|
||||||
private Properties properties;
|
private final Properties properties;
|
||||||
private BeanUtil beanUtil;
|
private final BeanUtil beanUtil;
|
||||||
|
|
||||||
public PerunFiltersContext(Properties properties, BeanUtil beanUtil) {
|
public PerunFiltersContext(Properties properties, BeanUtil beanUtil) {
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
|
|
|
@ -10,11 +10,11 @@ import java.util.Properties;
|
||||||
*/
|
*/
|
||||||
public class PerunRequestFilterParams {
|
public class PerunRequestFilterParams {
|
||||||
|
|
||||||
private String filterName;
|
private final String filterName;
|
||||||
|
|
||||||
private String propertyPrefix;
|
private final String propertyPrefix;
|
||||||
private Properties properties;
|
private final Properties properties;
|
||||||
private BeanUtil beanUtil;
|
private final BeanUtil beanUtil;
|
||||||
|
|
||||||
public PerunRequestFilterParams(String filterName, String propertyPrefix, Properties properties, BeanUtil beanUtil) {
|
public PerunRequestFilterParams(String filterName, String propertyPrefix, Properties properties, BeanUtil beanUtil) {
|
||||||
this.filterName = filterName;
|
this.filterName = filterName;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebHtmlClasses {
|
public class WebHtmlClasses {
|
||||||
|
|
||||||
private String classesFilePath;
|
private final String classesFilePath;
|
||||||
private Properties webHtmlClassesProperties;
|
private Properties webHtmlClassesProperties;
|
||||||
|
|
||||||
public WebHtmlClasses(PerunOidcConfig perunOidcConfig) {
|
public WebHtmlClasses(PerunOidcConfig perunOidcConfig) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ClientDetailsEntityJsonProcessor {
|
public class ClientDetailsEntityJsonProcessor {
|
||||||
|
|
||||||
private static JsonParser parser = new JsonParser();
|
private static final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
public static ClientDetailsEntity parse(String jsonString) {
|
public static ClientDetailsEntity parse(String jsonString) {
|
||||||
JsonElement jsonEl = parser.parse(jsonString);
|
JsonElement jsonEl = parser.parse(jsonString);
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class JWTBearerAuthenticationProvider implements AuthenticationProvider {
|
||||||
private ClientKeyCacheService validators;
|
private ClientKeyCacheService validators;
|
||||||
|
|
||||||
// Allow for time sync issues by having a window of X seconds.
|
// Allow for time sync issues by having a window of X seconds.
|
||||||
private int timeSkewAllowance = 300;
|
private final int timeSkewAllowance = 300;
|
||||||
|
|
||||||
// to load clients
|
// to load clients
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||||
*/
|
*/
|
||||||
public class JWTBearerClientAssertionTokenEndpointFilter extends AbstractAuthenticationProcessingFilter {
|
public class JWTBearerClientAssertionTokenEndpointFilter extends AbstractAuthenticationProcessingFilter {
|
||||||
|
|
||||||
private AuthenticationEntryPoint authenticationEntryPoint = new OAuth2AuthenticationEntryPoint();
|
private final AuthenticationEntryPoint authenticationEntryPoint = new OAuth2AuthenticationEntryPoint();
|
||||||
|
|
||||||
public JWTBearerClientAssertionTokenEndpointFilter(RequestMatcher additionalMatcher) {
|
public JWTBearerClientAssertionTokenEndpointFilter(RequestMatcher additionalMatcher) {
|
||||||
super(new ClientAssertionRequestMatcher(additionalMatcher));
|
super(new ClientAssertionRequestMatcher(additionalMatcher));
|
||||||
|
@ -110,7 +110,7 @@ public class JWTBearerClientAssertionTokenEndpointFilter extends AbstractAuthent
|
||||||
|
|
||||||
private static class ClientAssertionRequestMatcher implements RequestMatcher {
|
private static class ClientAssertionRequestMatcher implements RequestMatcher {
|
||||||
|
|
||||||
private RequestMatcher additionalMatcher;
|
private final RequestMatcher additionalMatcher;
|
||||||
|
|
||||||
public ClientAssertionRequestMatcher(RequestMatcher additionalMatcher) {
|
public ClientAssertionRequestMatcher(RequestMatcher additionalMatcher) {
|
||||||
this.additionalMatcher = additionalMatcher;
|
this.additionalMatcher = additionalMatcher;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.springframework.web.servlet.i18n.AbstractLocaleContextResolver;
|
||||||
*/
|
*/
|
||||||
public class ConfigurationBeanLocaleResolver extends AbstractLocaleContextResolver {
|
public class ConfigurationBeanLocaleResolver extends AbstractLocaleContextResolver {
|
||||||
|
|
||||||
private ConfigurationPropertiesBean config;
|
private final ConfigurationPropertiesBean config;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ConfigurationBeanLocaleResolver(ConfigurationPropertiesBean config) {
|
public ConfigurationBeanLocaleResolver(ConfigurationPropertiesBean config) {
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -46,9 +47,9 @@ public class JsonMessageSource extends AbstractMessageSource {
|
||||||
|
|
||||||
private Resource baseDirectory;
|
private Resource baseDirectory;
|
||||||
|
|
||||||
private Locale fallbackLocale = new Locale("en"); // US English is the fallback language
|
private final Locale fallbackLocale = new Locale("en"); // US English is the fallback language
|
||||||
|
|
||||||
private Map<Locale, List<JsonObject>> languageMaps = new HashMap<>();
|
private final Map<Locale, List<JsonObject>> languageMaps = new HashMap<>();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfigurationPropertiesBean config;
|
private ConfigurationPropertiesBean config;
|
||||||
|
@ -170,7 +171,7 @@ public class JsonMessageSource extends AbstractMessageSource {
|
||||||
log.info("No locale loaded, trying to load from {}", r);
|
log.info("No locale loaded, trying to load from {}", r);
|
||||||
|
|
||||||
JsonParser parser = new JsonParser();
|
JsonParser parser = new JsonParser();
|
||||||
JsonObject obj = (JsonObject) parser.parse(new InputStreamReader(r.getInputStream(), "UTF-8"));
|
JsonObject obj = (JsonObject) parser.parse(new InputStreamReader(r.getInputStream(), StandardCharsets.UTF_8));
|
||||||
|
|
||||||
set.add(obj);
|
set.add(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class ServerConfiguration {
|
||||||
public enum UserInfoTokenMethod {
|
public enum UserInfoTokenMethod {
|
||||||
HEADER,
|
HEADER,
|
||||||
FORM,
|
FORM,
|
||||||
QUERY;
|
QUERY
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuthorizationEndpointUri() {
|
public String getAuthorizationEndpointUri() {
|
||||||
|
@ -949,14 +949,9 @@ public class ServerConfiguration {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (userinfoSigningAlgValuesSupported == null) {
|
if (userinfoSigningAlgValuesSupported == null) {
|
||||||
if (other.userinfoSigningAlgValuesSupported != null) {
|
return other.userinfoSigningAlgValuesSupported == null;
|
||||||
return false;
|
} else return userinfoSigningAlgValuesSupported
|
||||||
}
|
.equals(other.userinfoSigningAlgValuesSupported);
|
||||||
} else if (!userinfoSigningAlgValuesSupported
|
|
||||||
.equals(other.userinfoSigningAlgValuesSupported)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,13 +205,8 @@ public class DefaultAddress implements Address {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (streetAddress == null) {
|
if (streetAddress == null) {
|
||||||
if (other.streetAddress != null) {
|
return other.streetAddress == null;
|
||||||
return false;
|
} else return streetAddress.equals(other.streetAddress);
|
||||||
}
|
|
||||||
} else if (!streetAddress.equals(other.streetAddress)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,13 +617,8 @@ public class DefaultUserInfo implements UserInfo {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (zoneinfo == null) {
|
if (zoneinfo == null) {
|
||||||
if (other.zoneinfo != null) {
|
return other.zoneinfo == null;
|
||||||
return false;
|
} else return zoneinfo.equals(other.zoneinfo);
|
||||||
}
|
|
||||||
} else if (!zoneinfo.equals(other.zoneinfo)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeObject(ObjectOutputStream out) throws IOException {
|
private void writeObject(ObjectOutputStream out) throws IOException {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.springframework.util.StringUtils;
|
||||||
@Converter
|
@Converter
|
||||||
public class JsonObjectStringConverter implements AttributeConverter<JsonObject, String> {
|
public class JsonObjectStringConverter implements AttributeConverter<JsonObject, String> {
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String convertToDatabaseColumn(JsonObject attribute) {
|
public String convertToDatabaseColumn(JsonObject attribute) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.springframework.stereotype.Component;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
|
public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
|
||||||
|
|
||||||
private ClientDetailsEntityService clientDetailsService;
|
private final ClientDetailsEntityService clientDetailsService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClientKeyCacheService validators;
|
private ClientKeyCacheService validators;
|
||||||
|
@ -63,7 +63,7 @@ public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JWTEncryptionAndDecryptionService encryptionService;
|
private JWTEncryptionAndDecryptionService encryptionService;
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor with arguments
|
* Constructor with arguments
|
||||||
|
@ -80,7 +80,7 @@ public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
|
||||||
public AuthorizationRequest createAuthorizationRequest(Map<String, String> inputParams) {
|
public AuthorizationRequest createAuthorizationRequest(Map<String, String> inputParams) {
|
||||||
|
|
||||||
|
|
||||||
AuthorizationRequest request = new AuthorizationRequest(inputParams, Collections.<String, String> emptyMap(),
|
AuthorizationRequest request = new AuthorizationRequest(inputParams, Collections.emptyMap(),
|
||||||
inputParams.get(OAuth2Utils.CLIENT_ID),
|
inputParams.get(OAuth2Utils.CLIENT_ID),
|
||||||
OAuth2Utils.parseParameterList(inputParams.get(OAuth2Utils.SCOPE)), null,
|
OAuth2Utils.parseParameterList(inputParams.get(OAuth2Utils.SCOPE)), null,
|
||||||
null, false, inputParams.get(OAuth2Utils.STATE),
|
null, false, inputParams.get(OAuth2Utils.STATE),
|
||||||
|
|
|
@ -17,38 +17,38 @@ package cz.muni.ics.openid.connect.request;
|
||||||
|
|
||||||
public interface ConnectRequestParameters {
|
public interface ConnectRequestParameters {
|
||||||
|
|
||||||
public String CLIENT_ID = "client_id";
|
String CLIENT_ID = "client_id";
|
||||||
public String RESPONSE_TYPE = "response_type";
|
String RESPONSE_TYPE = "response_type";
|
||||||
public String REDIRECT_URI = "redirect_uri";
|
String REDIRECT_URI = "redirect_uri";
|
||||||
public String STATE = "state";
|
String STATE = "state";
|
||||||
public String DISPLAY = "display";
|
String DISPLAY = "display";
|
||||||
public String REQUEST = "request";
|
String REQUEST = "request";
|
||||||
public String LOGIN_HINT = "login_hint";
|
String LOGIN_HINT = "login_hint";
|
||||||
public String MAX_AGE = "max_age";
|
String MAX_AGE = "max_age";
|
||||||
public String CLAIMS = "claims";
|
String CLAIMS = "claims";
|
||||||
public String SCOPE = "scope";
|
String SCOPE = "scope";
|
||||||
public String NONCE = "nonce";
|
String NONCE = "nonce";
|
||||||
public String PROMPT = "prompt";
|
String PROMPT = "prompt";
|
||||||
|
|
||||||
// prompt values
|
// prompt values
|
||||||
public String PROMPT_LOGIN = "login";
|
String PROMPT_LOGIN = "login";
|
||||||
public String PROMPT_NONE = "none";
|
String PROMPT_NONE = "none";
|
||||||
public String PROMPT_CONSENT = "consent";
|
String PROMPT_CONSENT = "consent";
|
||||||
public String PROMPT_SEPARATOR = " ";
|
String PROMPT_SEPARATOR = " ";
|
||||||
|
|
||||||
// extensions
|
// extensions
|
||||||
public String APPROVED_SITE = "approved_site";
|
String APPROVED_SITE = "approved_site";
|
||||||
|
|
||||||
// responses
|
// responses
|
||||||
public String ERROR = "error";
|
String ERROR = "error";
|
||||||
public String LOGIN_REQUIRED = "login_required";
|
String LOGIN_REQUIRED = "login_required";
|
||||||
|
|
||||||
// audience
|
// audience
|
||||||
public String AUD = "aud";
|
String AUD = "aud";
|
||||||
|
|
||||||
// PKCE
|
// PKCE
|
||||||
public String CODE_CHALLENGE = "code_challenge";
|
String CODE_CHALLENGE = "code_challenge";
|
||||||
public String CODE_CHALLENGE_METHOD = "code_challenge_method";
|
String CODE_CHALLENGE_METHOD = "code_challenge_method";
|
||||||
public String CODE_VERIFIER = "code_verifier";
|
String CODE_VERIFIER = "code_verifier";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class DefaultApprovedSiteService implements ApprovedSiteService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Predicate<ApprovedSite> isExpired = new Predicate<ApprovedSite>() {
|
private final Predicate<ApprovedSite> isExpired = new Predicate<ApprovedSite>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(ApprovedSite input) {
|
public boolean apply(ApprovedSite input) {
|
||||||
return (input != null && input.isExpired());
|
return (input != null && input.isExpired());
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.springframework.stereotype.Service;
|
||||||
@Service("scopeClaimTranslator")
|
@Service("scopeClaimTranslator")
|
||||||
public class DefaultScopeClaimTranslationService implements ScopeClaimTranslationService {
|
public class DefaultScopeClaimTranslationService implements ScopeClaimTranslationService {
|
||||||
|
|
||||||
private SetMultimap<String, String> scopesToClaims = HashMultimap.create();
|
private final SetMultimap<String, String> scopesToClaims = HashMultimap.create();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor; initializes scopesToClaims map
|
* Default constructor; initializes scopesToClaims map
|
||||||
|
|
|
@ -58,9 +58,9 @@ import org.springframework.web.servlet.view.AbstractView;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public abstract class AbstractClientEntityView extends AbstractView {
|
public abstract class AbstractClientEntityView extends AbstractView {
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.setExclusionStrategies(getExclusionStrategy())
|
.setExclusionStrategies(getExclusionStrategy())
|
||||||
.registerTypeAdapter(JWSAlgorithm.class, new JsonSerializer<JWSAlgorithm>() {
|
.registerTypeAdapter(JWSAlgorithm.class, new JsonSerializer<JWSAlgorithm>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.springframework.validation.BeanPropertyBindingResult;
|
||||||
public class ClientEntityViewForAdmins extends AbstractClientEntityView {
|
public class ClientEntityViewForAdmins extends AbstractClientEntityView {
|
||||||
|
|
||||||
public static final String VIEWNAME = "clientEntityViewAdmins";
|
public static final String VIEWNAME = "clientEntityViewAdmins";
|
||||||
private Set<String> blacklistedFields = ImmutableSet.of("additionalInformation");
|
private final Set<String> blacklistedFields = ImmutableSet.of("additionalInformation");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
|
@ -50,20 +50,13 @@ public class ClientEntityViewForAdmins extends AbstractClientEntityView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipField(FieldAttributes f) {
|
public boolean shouldSkipField(FieldAttributes f) {
|
||||||
if (blacklistedFields.contains(f.getName())) {
|
return blacklistedFields.contains(f.getName());
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.springframework.validation.BeanPropertyBindingResult;
|
||||||
@Component(ClientEntityViewForUsers.VIEWNAME)
|
@Component(ClientEntityViewForUsers.VIEWNAME)
|
||||||
public class ClientEntityViewForUsers extends AbstractClientEntityView {
|
public class ClientEntityViewForUsers extends AbstractClientEntityView {
|
||||||
|
|
||||||
private Set<String> whitelistedFields = ImmutableSet.of("clientName", "clientId", "id", "clientDescription", "scope", "logoUri");
|
private final Set<String> whitelistedFields = ImmutableSet.of("clientName", "clientId", "id", "clientDescription", "scope", "logoUri");
|
||||||
|
|
||||||
public static final String VIEWNAME = "clientEntityViewUsers";
|
public static final String VIEWNAME = "clientEntityViewUsers";
|
||||||
|
|
||||||
|
@ -53,20 +53,13 @@ public class ClientEntityViewForUsers extends AbstractClientEntityView {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipField(FieldAttributes f) {
|
public boolean shouldSkipField(FieldAttributes f) {
|
||||||
// whitelist the handful of fields that are good
|
// whitelist the handful of fields that are good
|
||||||
if (whitelistedFields.contains(f.getName())) {
|
return !whitelistedFields.contains(f.getName());
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class ClientInformationResponseView extends AbstractView {
|
||||||
public static final String VIEWNAME = "clientInformationResponseView";
|
public static final String VIEWNAME = "clientInformationResponseView";
|
||||||
|
|
||||||
// note that this won't serialize nulls by default
|
// note that this won't serialize nulls by default
|
||||||
private Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
* @see org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class JsonApprovedSiteView extends AbstractView {
|
||||||
|
|
||||||
public static final String VIEWNAME = "jsonApprovedSiteView";
|
public static final String VIEWNAME = "jsonApprovedSiteView";
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.setExclusionStrategies(new ExclusionStrategy() {
|
.setExclusionStrategies(new ExclusionStrategy() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -65,10 +65,7 @@ public class JsonApprovedSiteView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class JsonEntityView extends AbstractView {
|
||||||
|
|
||||||
public static final String VIEWNAME = "jsonEntityView";
|
public static final String VIEWNAME = "jsonEntityView";
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.setExclusionStrategies(new ExclusionStrategy() {
|
.setExclusionStrategies(new ExclusionStrategy() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,10 +60,7 @@ public class JsonEntityView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class JsonErrorView extends AbstractView {
|
||||||
|
|
||||||
public static final String VIEWNAME = "jsonErrorView";
|
public static final String VIEWNAME = "jsonErrorView";
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.setExclusionStrategies(new ExclusionStrategy() {
|
.setExclusionStrategies(new ExclusionStrategy() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,10 +67,7 @@ public class JsonErrorView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class UserInfoView extends AbstractView {
|
||||||
|
|
||||||
public static final String VIEWNAME = "userInfoView";
|
public static final String VIEWNAME = "userInfoView";
|
||||||
|
|
||||||
private static JsonParser jsonParser = new JsonParser();
|
private static final JsonParser jsonParser = new JsonParser();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScopeClaimTranslationService translator;
|
private ScopeClaimTranslationService translator;
|
||||||
|
@ -68,10 +68,7 @@ public class UserInfoView extends AbstractView {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldSkipClass(Class<?> clazz) {
|
public boolean shouldSkipClass(Class<?> clazz) {
|
||||||
// skip the JPA binding wrapper
|
// skip the JPA binding wrapper
|
||||||
if (clazz.equals(BeanPropertyBindingResult.class)) {
|
return clazz.equals(BeanPropertyBindingResult.class);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).create();
|
}).create();
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class AuthenticationTimeStamper extends SavedRequestAwareAuthenticationSu
|
||||||
session.removeAttribute(AuthorizationRequestFilter.PROMPT_REQUESTED);
|
session.removeAttribute(AuthorizationRequestFilter.PROMPT_REQUESTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Successful Authentication of " + authentication.getName() + " at " + authTimestamp.toString());
|
log.info("Successful Authentication of " + authentication.getName() + " at " + authTimestamp);
|
||||||
|
|
||||||
super.onAuthenticationSuccess(request, response, authentication);
|
super.onAuthenticationSuccess(request, response, authentication);
|
||||||
|
|
||||||
|
|
|
@ -58,8 +58,8 @@ public class BlacklistAPI {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BlacklistedSiteService blacklistService;
|
private BlacklistedSiteService blacklistService;
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all blacklisted sites
|
* Get a list of all blacklisted sites
|
||||||
|
|
|
@ -129,9 +129,9 @@ public class ClientAPI {
|
||||||
@Qualifier("clientAssertionValidator")
|
@Qualifier("clientAssertionValidator")
|
||||||
private AssertionValidator assertionValidator;
|
private AssertionValidator assertionValidator;
|
||||||
|
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.serializeNulls()
|
.serializeNulls()
|
||||||
.registerTypeAdapter(JWSAlgorithm.class, new JsonDeserializer<Algorithm>() {
|
.registerTypeAdapter(JWSAlgorithm.class, new JsonDeserializer<Algorithm>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||||
*/
|
*/
|
||||||
public class UserInfoInterceptor extends HandlerInterceptorAdapter {
|
public class UserInfoInterceptor extends HandlerInterceptorAdapter {
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.registerTypeHierarchyAdapter(GrantedAuthority.class,
|
.registerTypeHierarchyAdapter(GrantedAuthority.class,
|
||||||
(JsonSerializer<GrantedAuthority>) (src, typeOfSrc, context) -> new JsonPrimitive(src.getAuthority()))
|
(JsonSerializer<GrantedAuthority>) (src, typeOfSrc, context) -> new JsonPrimitive(src.getAuthority()))
|
||||||
.create();
|
.create();
|
||||||
|
@ -53,7 +53,7 @@ public class UserInfoInterceptor extends HandlerInterceptorAdapter {
|
||||||
@Autowired(required = false)
|
@Autowired(required = false)
|
||||||
private UserInfoService userInfoService;
|
private UserInfoService userInfoService;
|
||||||
|
|
||||||
private AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
|
private final AuthenticationTrustResolver trustResolver = new AuthenticationTrustResolverImpl();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||||
|
|
|
@ -58,8 +58,8 @@ public class WhitelistAPI {
|
||||||
@Autowired
|
@Autowired
|
||||||
private WhitelistedSiteService whitelistService;
|
private WhitelistedSiteService whitelistService;
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
private final Gson gson = new Gson();
|
||||||
private JsonParser parser = new JsonParser();
|
private final JsonParser parser = new JsonParser();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all whitelisted sites
|
* Get a list of all whitelisted sites
|
||||||
|
|
|
@ -196,13 +196,8 @@ public class Claim {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
if (other.value != null) {
|
return other.value == null;
|
||||||
return false;
|
} else return value.equals(other.value);
|
||||||
}
|
|
||||||
} else if (!value.equals(other.value)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,13 +140,8 @@ public class Policy {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (scopes == null) {
|
if (scopes == null) {
|
||||||
if (other.scopes != null) {
|
return other.scopes == null;
|
||||||
return false;
|
} else return scopes.equals(other.scopes);
|
||||||
}
|
|
||||||
} else if (!scopes.equals(other.scopes)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,13 +248,8 @@ public class ResourceSet {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
if (other.uri != null) {
|
return other.uri == null;
|
||||||
return false;
|
} else return uri.equals(other.uri);
|
||||||
}
|
|
||||||
} else if (!uri.equals(other.uri)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class JsonUtils {
|
public class JsonUtils {
|
||||||
|
|
||||||
private static Gson gson = new Gson();
|
private static final Gson gson = new Gson();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translate a set of strings to a JSON array, empty array returned as null
|
* Translate a set of strings to a JSON array, empty array returned as null
|
||||||
|
|
|
@ -145,9 +145,9 @@ public class AbstractPageOperationTemplateTest {
|
||||||
private static class CountingPageOperation extends AbstractPageOperationTemplate<String>{
|
private static class CountingPageOperation extends AbstractPageOperationTemplate<String>{
|
||||||
|
|
||||||
private int currentPageFetch;
|
private int currentPageFetch;
|
||||||
private int pageSize = 10;
|
private final int pageSize = 10;
|
||||||
private long counter = 0L;
|
private long counter = 0L;
|
||||||
private long startTime;
|
private final long startTime;
|
||||||
private long timeToLastFetch;
|
private long timeToLastFetch;
|
||||||
private long timeToPreviousFetch;
|
private long timeToPreviousFetch;
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class TestWebfingerURLNormalizer {
|
||||||
|
|
||||||
|
|
||||||
// Test fixture:
|
// Test fixture:
|
||||||
private ImmutableMap<String, String> inputToNormalized = new ImmutableMap.Builder<String, String>()
|
private final ImmutableMap<String, String> inputToNormalized = new ImmutableMap.Builder<String, String>()
|
||||||
.put("example.com", "https://example.com")
|
.put("example.com", "https://example.com")
|
||||||
.put("example.com:8080", "https://example.com:8080")
|
.put("example.com:8080", "https://example.com:8080")
|
||||||
.put("example.com/path", "https://example.com/path")
|
.put("example.com/path", "https://example.com/path")
|
||||||
|
|
|
@ -45,8 +45,8 @@ import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
public class TestJWKSetKeyStore {
|
public class TestJWKSetKeyStore {
|
||||||
|
|
||||||
private String RSAkid = "rsa_1";
|
private final String RSAkid = "rsa_1";
|
||||||
private JWK RSAjwk = new RSAKey(
|
private final JWK RSAjwk = new RSAKey(
|
||||||
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
||||||
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
||||||
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
||||||
|
@ -62,8 +62,8 @@ public class TestJWKSetKeyStore {
|
||||||
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
|
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
|
||||||
KeyUse.ENCRYPTION, null, JWEAlgorithm.RSA_OAEP, RSAkid, null, null, null, null, null);
|
KeyUse.ENCRYPTION, null, JWEAlgorithm.RSA_OAEP, RSAkid, null, null, null, null, null);
|
||||||
|
|
||||||
private String RSAkid_rsa2 = "rsa_2";
|
private final String RSAkid_rsa2 = "rsa_2";
|
||||||
private JWK RSAjwk_rsa2 = new RSAKey(
|
private final JWK RSAjwk_rsa2 = new RSAKey(
|
||||||
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
||||||
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
||||||
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
||||||
|
@ -82,8 +82,8 @@ public class TestJWKSetKeyStore {
|
||||||
|
|
||||||
List<JWK> keys_list = new LinkedList<>();
|
List<JWK> keys_list = new LinkedList<>();
|
||||||
private JWKSet jwkSet;
|
private JWKSet jwkSet;
|
||||||
private String ks_file = "ks.txt";
|
private final String ks_file = "ks.txt";
|
||||||
private String ks_file_badJWK = "ks_badJWK.txt";
|
private final String ks_file_badJWK = "ks_badJWK.txt";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void prepare() throws IOException {
|
public void prepare() throws IOException {
|
||||||
|
@ -93,7 +93,7 @@ public class TestJWKSetKeyStore {
|
||||||
jwkSet = new JWKSet(keys_list);
|
jwkSet = new JWKSet(keys_list);
|
||||||
jwkSet.getKeys();
|
jwkSet.getKeys();
|
||||||
|
|
||||||
byte jwtbyte[] = jwkSet.toString().getBytes();
|
byte[] jwtbyte = jwkSet.toString().getBytes();
|
||||||
FileOutputStream out = new FileOutputStream(ks_file);
|
FileOutputStream out = new FileOutputStream(ks_file);
|
||||||
out.write(jwtbyte);
|
out.write(jwtbyte);
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -135,7 +135,7 @@ public class TestJWKSetKeyStore {
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void ksBadJWKinput() throws IOException {
|
public void ksBadJWKinput() throws IOException {
|
||||||
|
|
||||||
byte jwtbyte[] = RSAjwk.toString().getBytes();
|
byte[] jwtbyte = RSAjwk.toString().getBytes();
|
||||||
FileOutputStream out = new FileOutputStream(ks_file_badJWK);
|
FileOutputStream out = new FileOutputStream(ks_file_badJWK);
|
||||||
out.write(jwtbyte);
|
out.write(jwtbyte);
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -180,7 +180,7 @@ public class TestJWKSetKeyStore {
|
||||||
}
|
}
|
||||||
assertTrue(thrown);
|
assertTrue(thrown);
|
||||||
|
|
||||||
ks.setJwkSet(jwkSet);;
|
ks.setJwkSet(jwkSet);
|
||||||
assertEquals(ks.getJwkSet(), jwkSet);
|
assertEquals(ks.getJwkSet(), jwkSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,17 +63,17 @@ import org.junit.rules.ExpectedException;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TestDefaultJWTEncryptionAndDecryptionService {
|
public class TestDefaultJWTEncryptionAndDecryptionService {
|
||||||
|
|
||||||
private String plainText = "The true sign of intelligence is not knowledge but imagination.";
|
private final String plainText = "The true sign of intelligence is not knowledge but imagination.";
|
||||||
|
|
||||||
private String issuer = "www.example.net";
|
private final String issuer = "www.example.net";
|
||||||
private String subject = "example_user";
|
private final String subject = "example_user";
|
||||||
private JWTClaimsSet claimsSet = null;
|
private JWTClaimsSet claimsSet = null;
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public ExpectedException exception = ExpectedException.none();
|
public ExpectedException exception = ExpectedException.none();
|
||||||
|
|
||||||
// Example data taken from rfc7516 appendix A
|
// Example data taken from rfc7516 appendix A
|
||||||
private String compactSerializedJwe = "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ." +
|
private final String compactSerializedJwe = "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ." +
|
||||||
"OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe" +
|
"OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe" +
|
||||||
"ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb" +
|
"ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb" +
|
||||||
"Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV" +
|
"Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV" +
|
||||||
|
@ -85,8 +85,8 @@ public class TestDefaultJWTEncryptionAndDecryptionService {
|
||||||
"SdiwkIr3ajwQzaBtQD_A." +
|
"SdiwkIr3ajwQzaBtQD_A." +
|
||||||
"XFBoMYUZodetZdvTiFvSkQ";
|
"XFBoMYUZodetZdvTiFvSkQ";
|
||||||
|
|
||||||
private String RSAkid = "rsa321";
|
private final String RSAkid = "rsa321";
|
||||||
private JWK RSAjwk = new RSAKey(
|
private final JWK RSAjwk = new RSAKey(
|
||||||
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
||||||
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
||||||
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
||||||
|
@ -102,8 +102,8 @@ public class TestDefaultJWTEncryptionAndDecryptionService {
|
||||||
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
|
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
|
||||||
KeyUse.ENCRYPTION, null, JWEAlgorithm.RSA_OAEP, RSAkid, null, null, null, null, null);
|
KeyUse.ENCRYPTION, null, JWEAlgorithm.RSA_OAEP, RSAkid, null, null, null, null, null);
|
||||||
|
|
||||||
private String RSAkid_2 = "rsa3210";
|
private final String RSAkid_2 = "rsa3210";
|
||||||
private JWK RSAjwk_2 = new RSAKey(
|
private final JWK RSAjwk_2 = new RSAKey(
|
||||||
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
new Base64URL("oahUIoWw0K0usKNuOR6H4wkf4oBUXHTxRvgb48E-BVvxkeDNjbC4he8rUW" +
|
||||||
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
"cJoZmds2h7M70imEVhRU5djINXtqllXI4DFqcI1DgjT9LewND8MW2Krf3S" +
|
||||||
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
"psk_ZkoFnilakGygTwpZ3uesH-PFABNIUYpOiN15dsQRkgr0vEhxN92i2a" +
|
||||||
|
@ -119,30 +119,30 @@ public class TestDefaultJWTEncryptionAndDecryptionService {
|
||||||
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
|
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
|
||||||
KeyUse.ENCRYPTION, null, JWEAlgorithm.RSA1_5, RSAkid_2, null, null, null, null, null);
|
KeyUse.ENCRYPTION, null, JWEAlgorithm.RSA1_5, RSAkid_2, null, null, null, null, null);
|
||||||
|
|
||||||
private String AESkid = "aes123";
|
private final String AESkid = "aes123";
|
||||||
private JWK AESjwk = new OctetSequenceKey(new Base64URL("GawgguFyGrWKav7AX4VKUg"),
|
private final JWK AESjwk = new OctetSequenceKey(new Base64URL("GawgguFyGrWKav7AX4VKUg"),
|
||||||
KeyUse.ENCRYPTION, null, JWEAlgorithm.A128KW,
|
KeyUse.ENCRYPTION, null, JWEAlgorithm.A128KW,
|
||||||
AESkid, null, null, null, null, null);
|
AESkid, null, null, null, null, null);
|
||||||
|
|
||||||
|
|
||||||
private Map<String, JWK> keys = new ImmutableMap.Builder<String, JWK>()
|
private final Map<String, JWK> keys = new ImmutableMap.Builder<String, JWK>()
|
||||||
.put(RSAkid, RSAjwk)
|
.put(RSAkid, RSAjwk)
|
||||||
.build();
|
.build();
|
||||||
private Map<String, JWK> keys_2 = new ImmutableMap.Builder<String, JWK>()
|
private final Map<String, JWK> keys_2 = new ImmutableMap.Builder<String, JWK>()
|
||||||
.put(RSAkid, RSAjwk)
|
.put(RSAkid, RSAjwk)
|
||||||
.put(RSAkid_2, RSAjwk_2)
|
.put(RSAkid_2, RSAjwk_2)
|
||||||
.build();
|
.build();
|
||||||
private Map<String, JWK> keys_3 = new ImmutableMap.Builder<String, JWK>()
|
private final Map<String, JWK> keys_3 = new ImmutableMap.Builder<String, JWK>()
|
||||||
.put(AESkid, AESjwk)
|
.put(AESkid, AESjwk)
|
||||||
.build();
|
.build();
|
||||||
private Map<String, JWK> keys_4= new ImmutableMap.Builder<String, JWK>()
|
private final Map<String, JWK> keys_4= new ImmutableMap.Builder<String, JWK>()
|
||||||
.put(RSAkid, RSAjwk)
|
.put(RSAkid, RSAjwk)
|
||||||
.put(RSAkid_2, RSAjwk_2)
|
.put(RSAkid_2, RSAjwk_2)
|
||||||
.put(AESkid, AESjwk)
|
.put(AESkid, AESjwk)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
private List<JWK> keys_list = new LinkedList<>();
|
private final List<JWK> keys_list = new LinkedList<>();
|
||||||
|
|
||||||
private DefaultJWTEncryptionAndDecryptionService service;
|
private DefaultJWTEncryptionAndDecryptionService service;
|
||||||
private DefaultJWTEncryptionAndDecryptionService service_2;
|
private DefaultJWTEncryptionAndDecryptionService service_2;
|
||||||
|
|
|
@ -53,11 +53,11 @@ public class TestBlacklistAwareRedirectResolver {
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private BlacklistAwareRedirectResolver resolver;
|
private BlacklistAwareRedirectResolver resolver;
|
||||||
|
|
||||||
private String blacklistedUri = "https://evil.example.com/";
|
private final String blacklistedUri = "https://evil.example.com/";
|
||||||
|
|
||||||
private String goodUri = "https://good.example.com/";
|
private final String goodUri = "https://good.example.com/";
|
||||||
|
|
||||||
private String pathUri = "https://good.example.com/with/path";
|
private final String pathUri = "https://good.example.com/with/path";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws java.lang.Exception
|
* @throws java.lang.Exception
|
||||||
|
|
|
@ -44,9 +44,9 @@ import org.springframework.security.oauth2.provider.OAuth2Request;
|
||||||
|
|
||||||
public class TestDefaultIntrospectionResultAssembler {
|
public class TestDefaultIntrospectionResultAssembler {
|
||||||
|
|
||||||
private IntrospectionResultAssembler assembler = new DefaultIntrospectionResultAssembler();
|
private final IntrospectionResultAssembler assembler = new DefaultIntrospectionResultAssembler();
|
||||||
|
|
||||||
private static DateFormatter dateFormat = new DateFormatter(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
|
private static final DateFormatter dateFormat = new DateFormatter(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldAssembleExpectedResultForAccessToken() throws ParseException {
|
public void shouldAssembleExpectedResultForAccessToken() throws ParseException {
|
||||||
|
|
|
@ -86,13 +86,13 @@ public class TestDefaultOAuth2ProviderTokenService {
|
||||||
private OAuth2Authentication authentication;
|
private OAuth2Authentication authentication;
|
||||||
private ClientDetailsEntity client;
|
private ClientDetailsEntity client;
|
||||||
private ClientDetailsEntity badClient;
|
private ClientDetailsEntity badClient;
|
||||||
private String clientId = "test_client";
|
private final String clientId = "test_client";
|
||||||
private String badClientId = "bad_client";
|
private final String badClientId = "bad_client";
|
||||||
private Set<String> scope = newHashSet("openid", "profile", "email", "offline_access");
|
private final Set<String> scope = newHashSet("openid", "profile", "email", "offline_access");
|
||||||
private OAuth2RefreshTokenEntity refreshToken;
|
private OAuth2RefreshTokenEntity refreshToken;
|
||||||
private OAuth2AccessTokenEntity accessToken;
|
private OAuth2AccessTokenEntity accessToken;
|
||||||
private String refreshTokenValue = "refresh_token_value";
|
private final String refreshTokenValue = "refresh_token_value";
|
||||||
private String userName = "6a50ac11786d402a9591d3e592ac770f";
|
private final String userName = "6a50ac11786d402a9591d3e592ac770f";
|
||||||
private final String issuer = "https://issuer.com/oidc/";
|
private final String issuer = "https://issuer.com/oidc/";
|
||||||
private TokenRequest tokenRequest;
|
private TokenRequest tokenRequest;
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@ public class TestDefaultSystemScopeService {
|
||||||
private SystemScope dynScope1;
|
private SystemScope dynScope1;
|
||||||
private SystemScope restrictedScope1;
|
private SystemScope restrictedScope1;
|
||||||
|
|
||||||
private String defaultDynScope1String = "defaultDynScope1";
|
private final String defaultDynScope1String = "defaultDynScope1";
|
||||||
private String defaultDynScope2String = "defaultDynScope2";
|
private final String defaultDynScope2String = "defaultDynScope2";
|
||||||
private String defaultScope1String = "defaultScope1";
|
private final String defaultScope1String = "defaultScope1";
|
||||||
private String defaultScope2String = "defaultScope2";
|
private final String defaultScope2String = "defaultScope2";
|
||||||
private String dynScope1String = "dynScope1";
|
private final String dynScope1String = "dynScope1";
|
||||||
private String restrictedScope1String = "restrictedScope1";
|
private final String restrictedScope1String = "restrictedScope1";
|
||||||
|
|
||||||
private Set<SystemScope> allScopes;
|
private Set<SystemScope> allScopes;
|
||||||
private Set<String> allScopeStrings;
|
private Set<String> allScopeStrings;
|
||||||
|
|
|
@ -67,9 +67,9 @@ public class TestJWTBearerAuthenticationProvider {
|
||||||
@Mock
|
@Mock
|
||||||
private JWTSigningAndValidationService validator;
|
private JWTSigningAndValidationService validator;
|
||||||
|
|
||||||
private GrantedAuthority authority1 = new SimpleGrantedAuthority("1");
|
private final GrantedAuthority authority1 = new SimpleGrantedAuthority("1");
|
||||||
private GrantedAuthority authority2 = new SimpleGrantedAuthority("2");
|
private final GrantedAuthority authority2 = new SimpleGrantedAuthority("2");
|
||||||
private GrantedAuthority authority3 = new SimpleGrantedAuthority("3");
|
private final GrantedAuthority authority3 = new SimpleGrantedAuthority("3");
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
|
@ -23,9 +23,9 @@ public class TestJsonMessageSource {
|
||||||
@Spy
|
@Spy
|
||||||
private ConfigurationPropertiesBean config;
|
private ConfigurationPropertiesBean config;
|
||||||
|
|
||||||
private Locale localeThatHasAFile = new Locale("en");
|
private final Locale localeThatHasAFile = new Locale("en");
|
||||||
|
|
||||||
private Locale localeThatDoesNotHaveAFile = new Locale("xx");
|
private final Locale localeThatDoesNotHaveAFile = new Locale("xx");
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
|
@ -43,9 +43,9 @@ public class TestDefaultBlacklistedSiteService {
|
||||||
private BlacklistedSite site1;
|
private BlacklistedSite site1;
|
||||||
private BlacklistedSite site2;
|
private BlacklistedSite site2;
|
||||||
|
|
||||||
private String uri1 = "black1";
|
private final String uri1 = "black1";
|
||||||
private String uri2 = "black2";
|
private final String uri2 = "black2";
|
||||||
private String uri3 = "not-black";
|
private final String uri3 = "not-black";
|
||||||
|
|
||||||
private Set<BlacklistedSite> blackListedSitesSet;
|
private Set<BlacklistedSite> blackListedSitesSet;
|
||||||
|
|
||||||
|
|
|
@ -37,10 +37,10 @@ public class TestDefaultOIDCTokenService {
|
||||||
private static final String CLIENT_ID = "client";
|
private static final String CLIENT_ID = "client";
|
||||||
private static final String KEY_ID = "key";
|
private static final String KEY_ID = "key";
|
||||||
|
|
||||||
private ConfigurationPropertiesBean configBean = new ConfigurationPropertiesBean();
|
private final ConfigurationPropertiesBean configBean = new ConfigurationPropertiesBean();
|
||||||
private ClientDetailsEntity client = new ClientDetailsEntity();
|
private final ClientDetailsEntity client = new ClientDetailsEntity();
|
||||||
private OAuth2AccessTokenEntity accessToken = new OAuth2AccessTokenEntity();
|
private final OAuth2AccessTokenEntity accessToken = new OAuth2AccessTokenEntity();
|
||||||
private OAuth2Request request = new OAuth2Request(CLIENT_ID) { };
|
private final OAuth2Request request = new OAuth2Request(CLIENT_ID) { };
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private JWTSigningAndValidationService jwtService;
|
private JWTSigningAndValidationService jwtService;
|
||||||
|
|
|
@ -68,25 +68,25 @@ public class TestDefaultUserInfoService {
|
||||||
private ClientDetailsEntity pairwiseClient3;
|
private ClientDetailsEntity pairwiseClient3;
|
||||||
private ClientDetailsEntity pairwiseClient4;
|
private ClientDetailsEntity pairwiseClient4;
|
||||||
|
|
||||||
private String adminUsername = "username";
|
private final String adminUsername = "username";
|
||||||
private String regularUsername = "regular";
|
private final String regularUsername = "regular";
|
||||||
private String adminSub = "adminSub12d3a1f34a2";
|
private final String adminSub = "adminSub12d3a1f34a2";
|
||||||
private String regularSub = "regularSub652ha23b";
|
private final String regularSub = "regularSub652ha23b";
|
||||||
|
|
||||||
private String pairwiseSub12 = "regularPairwise-12-31ijoef";
|
private final String pairwiseSub12 = "regularPairwise-12-31ijoef";
|
||||||
private String pairwiseSub3 = "regularPairwise-3-1ojadsio";
|
private final String pairwiseSub3 = "regularPairwise-3-1ojadsio";
|
||||||
private String pairwiseSub4 = "regularPairwise-4-1ojadsio";
|
private final String pairwiseSub4 = "regularPairwise-4-1ojadsio";
|
||||||
|
|
||||||
private String publicClientId1 = "publicClient-1-313124";
|
private final String publicClientId1 = "publicClient-1-313124";
|
||||||
private String publicClientId2 = "publicClient-2-4109312";
|
private final String publicClientId2 = "publicClient-2-4109312";
|
||||||
private String pairwiseClientId1 = "pairwiseClient-1-2312";
|
private final String pairwiseClientId1 = "pairwiseClient-1-2312";
|
||||||
private String pairwiseClientId2 = "pairwiseClient-2-324416";
|
private final String pairwiseClientId2 = "pairwiseClient-2-324416";
|
||||||
private String pairwiseClientId3 = "pairwiseClient-3-154157";
|
private final String pairwiseClientId3 = "pairwiseClient-3-154157";
|
||||||
private String pairwiseClientId4 = "pairwiseClient-4-4589723";
|
private final String pairwiseClientId4 = "pairwiseClient-4-4589723";
|
||||||
|
|
||||||
private String sectorIdentifier1 = "https://sector-identifier-12/url";
|
private final String sectorIdentifier1 = "https://sector-identifier-12/url";
|
||||||
private String sectorIdentifier2 = "https://sector-identifier-12/url2";
|
private final String sectorIdentifier2 = "https://sector-identifier-12/url2";
|
||||||
private String sectorIdentifier3 = "https://sector-identifier-3/url";
|
private final String sectorIdentifier3 = "https://sector-identifier-3/url";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,28 +61,28 @@ public class TestUUIDPairwiseIdentiferService {
|
||||||
private ClientDetailsEntity pairwiseClient4;
|
private ClientDetailsEntity pairwiseClient4;
|
||||||
private ClientDetailsEntity pairwiseClient5;
|
private ClientDetailsEntity pairwiseClient5;
|
||||||
|
|
||||||
private String regularUsername = "regular";
|
private final String regularUsername = "regular";
|
||||||
private String regularSub = "regularSub652ha23b";
|
private final String regularSub = "regularSub652ha23b";
|
||||||
private String pairwiseSub = "pairwise-12-regular-user";
|
private final String pairwiseSub = "pairwise-12-regular-user";
|
||||||
|
|
||||||
private String pairwiseClientId1 = "pairwiseClient-1-2312";
|
private final String pairwiseClientId1 = "pairwiseClient-1-2312";
|
||||||
private String pairwiseClientId2 = "pairwiseClient-2-324416";
|
private final String pairwiseClientId2 = "pairwiseClient-2-324416";
|
||||||
private String pairwiseClientId3 = "pairwiseClient-3-154157";
|
private final String pairwiseClientId3 = "pairwiseClient-3-154157";
|
||||||
private String pairwiseClientId4 = "pairwiseClient-4-4589723";
|
private final String pairwiseClientId4 = "pairwiseClient-4-4589723";
|
||||||
private String pairwiseClientId5 = "pairwiseClient-5-34908713";
|
private final String pairwiseClientId5 = "pairwiseClient-5-34908713";
|
||||||
|
|
||||||
private String sectorHost12 = "sector-identifier-12";
|
private final String sectorHost12 = "sector-identifier-12";
|
||||||
private String sectorHost3 = "sector-identifier-3";
|
private final String sectorHost3 = "sector-identifier-3";
|
||||||
private String clientHost4 = "client-redirect-4";
|
private final String clientHost4 = "client-redirect-4";
|
||||||
private String clientHost5 = "client-redirect-5";
|
private final String clientHost5 = "client-redirect-5";
|
||||||
|
|
||||||
private String sectorIdentifier1 = "https://" + sectorHost12 + "/url";
|
private final String sectorIdentifier1 = "https://" + sectorHost12 + "/url";
|
||||||
private String sectorIdentifier2 = "https://" + sectorHost12 + "/url2";
|
private final String sectorIdentifier2 = "https://" + sectorHost12 + "/url2";
|
||||||
private String sectorIdentifier3 = "https://" + sectorHost3 + "/url";
|
private final String sectorIdentifier3 = "https://" + sectorHost3 + "/url";
|
||||||
|
|
||||||
private Set<String> pairwiseClient3RedirectUris = ImmutableSet.of("https://" + sectorHost3 + "/oauth", "https://" + sectorHost3 + "/other");
|
private final Set<String> pairwiseClient3RedirectUris = ImmutableSet.of("https://" + sectorHost3 + "/oauth", "https://" + sectorHost3 + "/other");
|
||||||
private Set<String> pairwiseClient4RedirectUris = ImmutableSet.of("https://" + clientHost4 + "/oauth");
|
private final Set<String> pairwiseClient4RedirectUris = ImmutableSet.of("https://" + clientHost4 + "/oauth");
|
||||||
private Set<String> pairwiseClient5RedirectUris = ImmutableSet.of("https://" + clientHost5 + "/oauth", "https://" + clientHost5 + "/other");
|
private final Set<String> pairwiseClient5RedirectUris = ImmutableSet.of("https://" + clientHost5 + "/oauth", "https://" + clientHost5 + "/other");
|
||||||
|
|
||||||
private PairwiseIdentifier savedPairwiseIdentifier;
|
private PairwiseIdentifier savedPairwiseIdentifier;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class TestConnectTokenEnhancer {
|
||||||
private static final String CLIENT_ID = "client";
|
private static final String CLIENT_ID = "client";
|
||||||
private static final String KEY_ID = "key";
|
private static final String KEY_ID = "key";
|
||||||
|
|
||||||
private ConfigurationPropertiesBean configBean = new ConfigurationPropertiesBean();
|
private final ConfigurationPropertiesBean configBean = new ConfigurationPropertiesBean();
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private JWTSigningAndValidationService jwtService;
|
private JWTSigningAndValidationService jwtService;
|
||||||
|
@ -61,7 +61,7 @@ public class TestConnectTokenEnhancer {
|
||||||
@Mock
|
@Mock
|
||||||
private OAuth2Authentication authentication;
|
private OAuth2Authentication authentication;
|
||||||
|
|
||||||
private OAuth2Request request = new OAuth2Request(CLIENT_ID) { };
|
private final OAuth2Request request = new OAuth2Request(CLIENT_ID) { };
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
private ConnectTokenEnhancer enhancer = new ConnectTokenEnhancer();
|
private ConnectTokenEnhancer enhancer = new ConnectTokenEnhancer();
|
||||||
|
|
Loading…
Reference in New Issue