automated code formatting and cleanup

pull/544/merge
Justin Richer 2013-12-03 14:19:34 -05:00
parent e1e7f7a579
commit ebbc7209aa
184 changed files with 1633 additions and 1641 deletions

View File

@ -16,6 +16,8 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.oauth2.introspectingfilter; package org.mitre.oauth2.introspectingfilter;
import static org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod.SECRET_BASIC;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
@ -29,7 +31,6 @@ import org.mitre.oauth2.introspectingfilter.service.IntrospectionAuthorityGrante
import org.mitre.oauth2.introspectingfilter.service.IntrospectionConfigurationService; import org.mitre.oauth2.introspectingfilter.service.IntrospectionConfigurationService;
import org.mitre.oauth2.introspectingfilter.service.impl.SimpleIntrospectionAuthorityGranter; import org.mitre.oauth2.introspectingfilter.service.impl.SimpleIntrospectionAuthorityGranter;
import org.mitre.oauth2.model.RegisteredClient; import org.mitre.oauth2.model.RegisteredClient;
import org.mitre.openid.connect.client.service.ClientConfigurationService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod; import org.springframework.http.HttpMethod;
@ -53,8 +54,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.nimbusds.jose.util.Base64; import com.nimbusds.jose.util.Base64;
import static org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod.SECRET_BASIC;
/** /**
* This ResourceServerTokenServices implementation introspects incoming tokens at a * This ResourceServerTokenServices implementation introspects incoming tokens at a
* server's introspection endpoint URL and passes an Authentication object along * server's introspection endpoint URL and passes an Authentication object along
@ -142,14 +141,14 @@ public class IntrospectingTokenService implements ResourceServerTokenServices {
// find out which URL to ask // find out which URL to ask
String introspectionUrl; String introspectionUrl;
RegisteredClient client; RegisteredClient client;
try { try {
introspectionUrl = introspectionConfigurationService.getIntrospectionUrl(accessToken); introspectionUrl = introspectionConfigurationService.getIntrospectionUrl(accessToken);
client = introspectionConfigurationService.getClientConfiguration(accessToken); client = introspectionConfigurationService.getClientConfiguration(accessToken);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
logger.error("Unable to load introspection URL or client configuration", e); logger.error("Unable to load introspection URL or client configuration", e);
return false; return false;
} }
// Use the SpringFramework RestTemplate to send the request to the // Use the SpringFramework RestTemplate to send the request to the
// endpoint // endpoint
String validatedToken = null; String validatedToken = null;

View File

@ -32,7 +32,6 @@ import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -54,7 +53,7 @@ public class OAuth2AccessTokenImpl implements OAuth2AccessToken {
DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); DateFormat dateFormater = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
if (token.get("exp") != null) { if (token.get("exp") != null) {
try { try {
expireDate = dateFormater.parse(token.get("exp").getAsString()); expireDate = dateFormater.parse(token.get("exp").getAsString());
} catch (ParseException ex) { } catch (ParseException ex) {
Logger.getLogger(IntrospectingTokenService.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(IntrospectingTokenService.class.getName()).log(Level.SEVERE, null, ex);
} }

View File

@ -62,15 +62,15 @@ public class JWTParsingIntrospectionConfigurationService implements Introspectio
private String getIssuer(String accessToken) { private String getIssuer(String accessToken) {
try { try {
JWT jwt = JWTParser.parse(accessToken); JWT jwt = JWTParser.parse(accessToken);
String issuer = jwt.getJWTClaimsSet().getIssuer(); String issuer = jwt.getJWTClaimsSet().getIssuer();
return issuer; return issuer;
} catch (ParseException e) { } catch (ParseException e) {
throw new IllegalArgumentException("Unable to parse JWT", e); throw new IllegalArgumentException("Unable to parse JWT", e);
} }
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -98,27 +98,27 @@ public class JWTParsingIntrospectionConfigurationService implements Introspectio
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.oauth2.introspectingfilter.service.IntrospectionConfigurationService#getClientConfiguration(java.lang.String) * @see org.mitre.oauth2.introspectingfilter.service.IntrospectionConfigurationService#getClientConfiguration(java.lang.String)
*/ */
@Override @Override
public RegisteredClient getClientConfiguration(String accessToken) { public RegisteredClient getClientConfiguration(String accessToken) {
String issuer = getIssuer(accessToken); String issuer = getIssuer(accessToken);
if (!Strings.isNullOrEmpty(issuer)) { if (!Strings.isNullOrEmpty(issuer)) {
ServerConfiguration server = serverConfigurationService.getServerConfiguration(issuer); ServerConfiguration server = serverConfigurationService.getServerConfiguration(issuer);
if (server != null) { if (server != null) {
RegisteredClient client = clientConfigurationService.getClientConfiguration(server); RegisteredClient client = clientConfigurationService.getClientConfiguration(server);
if (client != null) { if (client != null) {
return client; return client;
} else { } else {
throw new IllegalArgumentException("Could not find client configuration for issuer " + issuer); throw new IllegalArgumentException("Could not find client configuration for issuer " + issuer);
} }
} else { } else {
throw new IllegalArgumentException("Could not find server configuration for issuer " + issuer); throw new IllegalArgumentException("Could not find server configuration for issuer " + issuer);
} }
} else { } else {
throw new IllegalArgumentException("No issuer claim found in JWT"); throw new IllegalArgumentException("No issuer claim found in JWT");
} }
} }

View File

@ -74,9 +74,9 @@ public class StaticIntrospectionConfigurationService implements IntrospectionCon
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.oauth2.introspectingfilter.service.IntrospectionConfigurationService#getClientConfiguration(java.lang.String) * @see org.mitre.oauth2.introspectingfilter.service.IntrospectionConfigurationService#getClientConfiguration(java.lang.String)
*/ */
@Override @Override
public RegisteredClient getClientConfiguration(String accessToken) { public RegisteredClient getClientConfiguration(String accessToken) {
return getClientConfiguration(); return getClientConfiguration();
} }
} }

View File

@ -16,6 +16,8 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client; package org.mitre.openid.connect.client;
import static org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod.SECRET_BASIC;
import java.io.IOException; import java.io.IOException;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.URI; import java.net.URI;
@ -63,8 +65,6 @@ import com.nimbusds.jose.util.Base64;
import com.nimbusds.jwt.ReadOnlyJWTClaimsSet; import com.nimbusds.jwt.ReadOnlyJWTClaimsSet;
import com.nimbusds.jwt.SignedJWT; import com.nimbusds.jwt.SignedJWT;
import static org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod.*;
/** /**
* OpenID Connect Authentication Filter class * OpenID Connect Authentication Filter class
* *

View File

@ -19,6 +19,13 @@
*/ */
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.mitre.discovery.util.JsonUtils.getAsBoolean;
import static org.mitre.discovery.util.JsonUtils.getAsEncryptionMethodList;
import static org.mitre.discovery.util.JsonUtils.getAsJweAlgorithmList;
import static org.mitre.discovery.util.JsonUtils.getAsJwsAlgorithmList;
import static org.mitre.discovery.util.JsonUtils.getAsString;
import static org.mitre.discovery.util.JsonUtils.getAsStringList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -40,8 +47,6 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import static org.mitre.discovery.util.JsonUtils.*;
/** /**
* *
* Dynamically fetches OpenID Connect server configurations based on the issuer. Caches the server configurations. * Dynamically fetches OpenID Connect server configurations based on the issuer. Caches the server configurations.

View File

@ -60,8 +60,8 @@ public class PlainAuthRequestUrlBuilder implements AuthRequestUrlBuilder {
// Optional parameters: // Optional parameters:
for (Entry<String, String> option : options.entrySet()) { for (Entry<String, String> option : options.entrySet()) {
uriBuilder.addParameter(option.getKey(), option.getValue()); uriBuilder.addParameter(option.getKey(), option.getValue());
} }
return uriBuilder.build().toString(); return uriBuilder.build().toString();

View File

@ -68,8 +68,8 @@ public class SignedAuthRequestUrlBuilder implements AuthRequestUrlBuilder {
// Optional parameters // Optional parameters
for (Entry<String, String> option : options.entrySet()) { for (Entry<String, String> option : options.entrySet()) {
claims.setClaim(option.getKey(), option.getValue()); claims.setClaim(option.getKey(), option.getValue());
} }

View File

@ -16,6 +16,11 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -27,11 +32,6 @@ import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -17,6 +17,11 @@
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -27,11 +32,6 @@ import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -16,7 +16,9 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import java.util.Collections; import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
import java.util.Map; import java.util.Map;
import org.junit.Before; import org.junit.Before;
@ -29,9 +31,6 @@ import org.springframework.security.authentication.AuthenticationServiceExceptio
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -16,6 +16,10 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -46,10 +50,6 @@ import com.nimbusds.jose.util.Base64URL;
import com.nimbusds.jwt.ReadOnlyJWTClaimsSet; import com.nimbusds.jwt.ReadOnlyJWTClaimsSet;
import com.nimbusds.jwt.SignedJWT; import com.nimbusds.jwt.SignedJWT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/** /**
* @author wkim * @author wkim
* *
@ -148,8 +148,8 @@ public class TestSignedAuthRequestUrlBuilder {
assertEquals(nonce, claims.getClaim("nonce")); assertEquals(nonce, claims.getClaim("nonce"));
assertEquals(state, claims.getClaim("state")); assertEquals(state, claims.getClaim("state"));
for (String claim : options.keySet()) { for (String claim : options.keySet()) {
assertEquals(options.get(claim), claims.getClaim(claim)); assertEquals(options.get(claim), claims.getClaim(claim));
} }
} }
@Test(expected = AuthenticationServiceException.class) @Test(expected = AuthenticationServiceException.class)

View File

@ -16,6 +16,12 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -28,12 +34,6 @@ import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -16,6 +16,12 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -26,12 +32,6 @@ import org.mitre.openid.connect.config.ServerConfiguration;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -16,6 +16,10 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.client.service.impl; package org.mitre.openid.connect.client.service.impl;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import org.junit.Before; import org.junit.Before;
@ -26,10 +30,6 @@ import org.springframework.security.authentication.AuthenticationServiceExceptio
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -150,8 +150,8 @@ public class JsonUtils {
if (strings != null) { if (strings != null) {
List<JWSAlgorithm> algs = new ArrayList<JWSAlgorithm>(); List<JWSAlgorithm> algs = new ArrayList<JWSAlgorithm>();
for (String alg : strings) { for (String alg : strings) {
algs.add(JWSAlgorithm.parse(alg)); algs.add(JWSAlgorithm.parse(alg));
} }
return algs; return algs;
} else { } else {
return null; return null;
@ -166,8 +166,8 @@ public class JsonUtils {
if (strings != null) { if (strings != null) {
List<JWEAlgorithm> algs = new ArrayList<JWEAlgorithm>(); List<JWEAlgorithm> algs = new ArrayList<JWEAlgorithm>();
for (String alg : strings) { for (String alg : strings) {
algs.add(JWEAlgorithm.parse(alg)); algs.add(JWEAlgorithm.parse(alg));
} }
return algs; return algs;
} else { } else {
return null; return null;
@ -182,8 +182,8 @@ public class JsonUtils {
if (strings != null) { if (strings != null) {
List<EncryptionMethod> algs = new ArrayList<EncryptionMethod>(); List<EncryptionMethod> algs = new ArrayList<EncryptionMethod>();
for (String alg : strings) { for (String alg : strings) {
algs.add(EncryptionMethod.parse(alg)); algs.add(EncryptionMethod.parse(alg));
} }
return algs; return algs;
} else { } else {
return null; return null;

View File

@ -58,15 +58,15 @@ public class JWKSetKeyStore {
if (location.exists() && location.isReadable()) { if (location.exists() && location.isReadable()) {
try { try {
// read in the file from disk // read in the file from disk
String s = CharStreams.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8)); String s = CharStreams.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8));
// parse it into a jwkSet object // parse it into a jwkSet object
jwkSet = JWKSet.parse(s); jwkSet = JWKSet.parse(s);
} catch (IOException e) { } catch (IOException e) {
throw new IllegalArgumentException("Key Set resource could not be read: " + location); throw new IllegalArgumentException("Key Set resource could not be read: " + location);
} catch (ParseException e) { } catch (ParseException e) {
throw new IllegalArgumentException("Key Set resource could not be parsed: " + location); } throw new IllegalArgumentException("Key Set resource could not be parsed: " + location); }
} else { } else {
throw new IllegalArgumentException("Key Set resource could not be read: " + location); throw new IllegalArgumentException("Key Set resource could not be read: " + location);

View File

@ -274,20 +274,20 @@ public class DefaultJwtEncryptionAndDecryptionService implements JwtEncryptionAn
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.jwt.encryption.service.JwtEncryptionAndDecryptionService#getAllEncryptionEncsSupported() * @see org.mitre.jwt.encryption.service.JwtEncryptionAndDecryptionService#getAllEncryptionEncsSupported()
*/ */
@Override @Override
public Collection<EncryptionMethod> getAllEncryptionEncsSupported() { public Collection<EncryptionMethod> getAllEncryptionEncsSupported() {
Set<EncryptionMethod> encs = new HashSet<EncryptionMethod>(); Set<EncryptionMethod> encs = new HashSet<EncryptionMethod>();
for (JWEEncrypter encrypter : encrypters.values()) { for (JWEEncrypter encrypter : encrypters.values()) {
encs.addAll(encrypter.supportedEncryptionMethods()); encs.addAll(encrypter.supportedEncryptionMethods());
} }
for (JWEDecrypter decrypter : decrypters.values()) { for (JWEDecrypter decrypter : decrypters.values()) {
encs.addAll(decrypter.supportedEncryptionMethods()); encs.addAll(decrypter.supportedEncryptionMethods());
} }
return encs; return encs;
} }
} }

View File

@ -122,18 +122,18 @@ public class JWKSetCacheService {
} }
/** /**
* @author jricher * @author jricher
* *
*/ */
private class JWKSetEncryptorFetcher extends CacheLoader<String, JwtEncryptionAndDecryptionService> { private class JWKSetEncryptorFetcher extends CacheLoader<String, JwtEncryptionAndDecryptionService> {
private HttpClient httpClient = new DefaultHttpClient(); private HttpClient httpClient = new DefaultHttpClient();
private HttpComponentsClientHttpRequestFactory httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient); private HttpComponentsClientHttpRequestFactory httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
private RestTemplate restTemplate = new RestTemplate(httpFactory); private RestTemplate restTemplate = new RestTemplate(httpFactory);
/* (non-Javadoc) /* (non-Javadoc)
* @see com.google.common.cache.CacheLoader#load(java.lang.Object) * @see com.google.common.cache.CacheLoader#load(java.lang.Object)
*/ */
@Override @Override
public JwtEncryptionAndDecryptionService load(String key) throws Exception { public JwtEncryptionAndDecryptionService load(String key) throws Exception {
String jsonString = restTemplate.getForObject(key, String.class); String jsonString = restTemplate.getForObject(key, String.class);
JWKSet jwkSet = JWKSet.parse(jsonString); JWKSet jwkSet = JWKSet.parse(jsonString);
@ -142,7 +142,7 @@ public class JWKSetCacheService {
JwtEncryptionAndDecryptionService service = new DefaultJwtEncryptionAndDecryptionService(keyStore); JwtEncryptionAndDecryptionService service = new DefaultJwtEncryptionAndDecryptionService(keyStore);
return service; return service;
} }
} }
} }

View File

@ -74,7 +74,7 @@ public class ClientDetailsEntity implements ClientDetails {
/** /**
* *
*/ */
private static final int DEFAULT_ID_TOKEN_VALIDITY_SECONDS = 600; private static final int DEFAULT_ID_TOKEN_VALIDITY_SECONDS = 600;
private static final long serialVersionUID = -1617727085733786296L; private static final long serialVersionUID = -1617727085733786296L;

View File

@ -579,257 +579,257 @@ public class RegisteredClient {
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getRequestObjectSigningAlgEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getRequestObjectSigningAlgEmbed()
*/ */
public JWSAlgorithmEmbed getRequestObjectSigningAlgEmbed() { public JWSAlgorithmEmbed getRequestObjectSigningAlgEmbed() {
return client.getRequestObjectSigningAlgEmbed(); return client.getRequestObjectSigningAlgEmbed();
} }
/** /**
* @param requestObjectSigningAlg * @param requestObjectSigningAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setRequestObjectSigningAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setRequestObjectSigningAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed)
*/ */
public void setRequestObjectSigningAlgEmbed(JWSAlgorithmEmbed requestObjectSigningAlg) { public void setRequestObjectSigningAlgEmbed(JWSAlgorithmEmbed requestObjectSigningAlg) {
client.setRequestObjectSigningAlgEmbed(requestObjectSigningAlg); client.setRequestObjectSigningAlgEmbed(requestObjectSigningAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoSignedResponseAlgEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoSignedResponseAlgEmbed()
*/ */
public JWSAlgorithmEmbed getUserInfoSignedResponseAlgEmbed() { public JWSAlgorithmEmbed getUserInfoSignedResponseAlgEmbed() {
return client.getUserInfoSignedResponseAlgEmbed(); return client.getUserInfoSignedResponseAlgEmbed();
} }
/** /**
* @param userInfoSignedResponseAlg * @param userInfoSignedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoSignedResponseAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoSignedResponseAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed)
*/ */
public void setUserInfoSignedResponseAlgEmbed(JWSAlgorithmEmbed userInfoSignedResponseAlg) { public void setUserInfoSignedResponseAlgEmbed(JWSAlgorithmEmbed userInfoSignedResponseAlg) {
client.setUserInfoSignedResponseAlgEmbed(userInfoSignedResponseAlg); client.setUserInfoSignedResponseAlgEmbed(userInfoSignedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseAlgEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseAlgEmbed()
*/ */
public JWEAlgorithmEmbed getUserInfoEncryptedResponseAlgEmbed() { public JWEAlgorithmEmbed getUserInfoEncryptedResponseAlgEmbed() {
return client.getUserInfoEncryptedResponseAlgEmbed(); return client.getUserInfoEncryptedResponseAlgEmbed();
} }
/** /**
* @param userInfoEncryptedResponseAlg * @param userInfoEncryptedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseAlgEmbed(org.mitre.jose.JWEAlgorithmEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseAlgEmbed(org.mitre.jose.JWEAlgorithmEmbed)
*/ */
public void setUserInfoEncryptedResponseAlgEmbed(JWEAlgorithmEmbed userInfoEncryptedResponseAlg) { public void setUserInfoEncryptedResponseAlgEmbed(JWEAlgorithmEmbed userInfoEncryptedResponseAlg) {
client.setUserInfoEncryptedResponseAlgEmbed(userInfoEncryptedResponseAlg); client.setUserInfoEncryptedResponseAlgEmbed(userInfoEncryptedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseEncEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseEncEmbed()
*/ */
public JWEEncryptionMethodEmbed getUserInfoEncryptedResponseEncEmbed() { public JWEEncryptionMethodEmbed getUserInfoEncryptedResponseEncEmbed() {
return client.getUserInfoEncryptedResponseEncEmbed(); return client.getUserInfoEncryptedResponseEncEmbed();
} }
/** /**
* @param userInfoEncryptedResponseEnc * @param userInfoEncryptedResponseEnc
* @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseEncEmbed(org.mitre.jose.JWEEncryptionMethodEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseEncEmbed(org.mitre.jose.JWEEncryptionMethodEmbed)
*/ */
public void setUserInfoEncryptedResponseEncEmbed(JWEEncryptionMethodEmbed userInfoEncryptedResponseEnc) { public void setUserInfoEncryptedResponseEncEmbed(JWEEncryptionMethodEmbed userInfoEncryptedResponseEnc) {
client.setUserInfoEncryptedResponseEncEmbed(userInfoEncryptedResponseEnc); client.setUserInfoEncryptedResponseEncEmbed(userInfoEncryptedResponseEnc);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenSignedResponseAlgEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenSignedResponseAlgEmbed()
*/ */
public JWSAlgorithmEmbed getIdTokenSignedResponseAlgEmbed() { public JWSAlgorithmEmbed getIdTokenSignedResponseAlgEmbed() {
return client.getIdTokenSignedResponseAlgEmbed(); return client.getIdTokenSignedResponseAlgEmbed();
} }
/** /**
* @param idTokenSignedResponseAlg * @param idTokenSignedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenSignedResponseAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenSignedResponseAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed)
*/ */
public void setIdTokenSignedResponseAlgEmbed(JWSAlgorithmEmbed idTokenSignedResponseAlg) { public void setIdTokenSignedResponseAlgEmbed(JWSAlgorithmEmbed idTokenSignedResponseAlg) {
client.setIdTokenSignedResponseAlgEmbed(idTokenSignedResponseAlg); client.setIdTokenSignedResponseAlgEmbed(idTokenSignedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseAlgEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseAlgEmbed()
*/ */
public JWEAlgorithmEmbed getIdTokenEncryptedResponseAlgEmbed() { public JWEAlgorithmEmbed getIdTokenEncryptedResponseAlgEmbed() {
return client.getIdTokenEncryptedResponseAlgEmbed(); return client.getIdTokenEncryptedResponseAlgEmbed();
} }
/** /**
* @param idTokenEncryptedResponseAlg * @param idTokenEncryptedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseAlgEmbed(org.mitre.jose.JWEAlgorithmEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseAlgEmbed(org.mitre.jose.JWEAlgorithmEmbed)
*/ */
public void setIdTokenEncryptedResponseAlgEmbed(JWEAlgorithmEmbed idTokenEncryptedResponseAlg) { public void setIdTokenEncryptedResponseAlgEmbed(JWEAlgorithmEmbed idTokenEncryptedResponseAlg) {
client.setIdTokenEncryptedResponseAlgEmbed(idTokenEncryptedResponseAlg); client.setIdTokenEncryptedResponseAlgEmbed(idTokenEncryptedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseEncEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseEncEmbed()
*/ */
public JWEEncryptionMethodEmbed getIdTokenEncryptedResponseEncEmbed() { public JWEEncryptionMethodEmbed getIdTokenEncryptedResponseEncEmbed() {
return client.getIdTokenEncryptedResponseEncEmbed(); return client.getIdTokenEncryptedResponseEncEmbed();
} }
/** /**
* @param idTokenEncryptedResponseEnc * @param idTokenEncryptedResponseEnc
* @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseEncEmbed(org.mitre.jose.JWEEncryptionMethodEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseEncEmbed(org.mitre.jose.JWEEncryptionMethodEmbed)
*/ */
public void setIdTokenEncryptedResponseEncEmbed(JWEEncryptionMethodEmbed idTokenEncryptedResponseEnc) { public void setIdTokenEncryptedResponseEncEmbed(JWEEncryptionMethodEmbed idTokenEncryptedResponseEnc) {
client.setIdTokenEncryptedResponseEncEmbed(idTokenEncryptedResponseEnc); client.setIdTokenEncryptedResponseEncEmbed(idTokenEncryptedResponseEnc);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getRequestObjectSigningAlg() * @see org.mitre.oauth2.model.ClientDetailsEntity#getRequestObjectSigningAlg()
*/ */
public JWSAlgorithm getRequestObjectSigningAlg() { public JWSAlgorithm getRequestObjectSigningAlg() {
return client.getRequestObjectSigningAlg(); return client.getRequestObjectSigningAlg();
} }
/** /**
* @param requestObjectSigningAlg * @param requestObjectSigningAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setRequestObjectSigningAlg(com.nimbusds.jose.JWSAlgorithm) * @see org.mitre.oauth2.model.ClientDetailsEntity#setRequestObjectSigningAlg(com.nimbusds.jose.JWSAlgorithm)
*/ */
public void setRequestObjectSigningAlg(JWSAlgorithm requestObjectSigningAlg) { public void setRequestObjectSigningAlg(JWSAlgorithm requestObjectSigningAlg) {
client.setRequestObjectSigningAlg(requestObjectSigningAlg); client.setRequestObjectSigningAlg(requestObjectSigningAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoSignedResponseAlg() * @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoSignedResponseAlg()
*/ */
public JWSAlgorithm getUserInfoSignedResponseAlg() { public JWSAlgorithm getUserInfoSignedResponseAlg() {
return client.getUserInfoSignedResponseAlg(); return client.getUserInfoSignedResponseAlg();
} }
/** /**
* @param userInfoSignedResponseAlg * @param userInfoSignedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoSignedResponseAlg(com.nimbusds.jose.JWSAlgorithm) * @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoSignedResponseAlg(com.nimbusds.jose.JWSAlgorithm)
*/ */
public void setUserInfoSignedResponseAlg(JWSAlgorithm userInfoSignedResponseAlg) { public void setUserInfoSignedResponseAlg(JWSAlgorithm userInfoSignedResponseAlg) {
client.setUserInfoSignedResponseAlg(userInfoSignedResponseAlg); client.setUserInfoSignedResponseAlg(userInfoSignedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseAlg() * @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseAlg()
*/ */
public JWEAlgorithm getUserInfoEncryptedResponseAlg() { public JWEAlgorithm getUserInfoEncryptedResponseAlg() {
return client.getUserInfoEncryptedResponseAlg(); return client.getUserInfoEncryptedResponseAlg();
} }
/** /**
* @param userInfoEncryptedResponseAlg * @param userInfoEncryptedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseAlg(com.nimbusds.jose.JWEAlgorithm) * @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseAlg(com.nimbusds.jose.JWEAlgorithm)
*/ */
public void setUserInfoEncryptedResponseAlg(JWEAlgorithm userInfoEncryptedResponseAlg) { public void setUserInfoEncryptedResponseAlg(JWEAlgorithm userInfoEncryptedResponseAlg) {
client.setUserInfoEncryptedResponseAlg(userInfoEncryptedResponseAlg); client.setUserInfoEncryptedResponseAlg(userInfoEncryptedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseEnc() * @see org.mitre.oauth2.model.ClientDetailsEntity#getUserInfoEncryptedResponseEnc()
*/ */
public EncryptionMethod getUserInfoEncryptedResponseEnc() { public EncryptionMethod getUserInfoEncryptedResponseEnc() {
return client.getUserInfoEncryptedResponseEnc(); return client.getUserInfoEncryptedResponseEnc();
} }
/** /**
* @param userInfoEncryptedResponseEnc * @param userInfoEncryptedResponseEnc
* @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseEnc(com.nimbusds.jose.EncryptionMethod) * @see org.mitre.oauth2.model.ClientDetailsEntity#setUserInfoEncryptedResponseEnc(com.nimbusds.jose.EncryptionMethod)
*/ */
public void setUserInfoEncryptedResponseEnc(EncryptionMethod userInfoEncryptedResponseEnc) { public void setUserInfoEncryptedResponseEnc(EncryptionMethod userInfoEncryptedResponseEnc) {
client.setUserInfoEncryptedResponseEnc(userInfoEncryptedResponseEnc); client.setUserInfoEncryptedResponseEnc(userInfoEncryptedResponseEnc);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenSignedResponseAlg() * @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenSignedResponseAlg()
*/ */
public JWSAlgorithm getIdTokenSignedResponseAlg() { public JWSAlgorithm getIdTokenSignedResponseAlg() {
return client.getIdTokenSignedResponseAlg(); return client.getIdTokenSignedResponseAlg();
} }
/** /**
* @param idTokenSignedResponseAlg * @param idTokenSignedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenSignedResponseAlg(com.nimbusds.jose.JWSAlgorithm) * @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenSignedResponseAlg(com.nimbusds.jose.JWSAlgorithm)
*/ */
public void setIdTokenSignedResponseAlg(JWSAlgorithm idTokenSignedResponseAlg) { public void setIdTokenSignedResponseAlg(JWSAlgorithm idTokenSignedResponseAlg) {
client.setIdTokenSignedResponseAlg(idTokenSignedResponseAlg); client.setIdTokenSignedResponseAlg(idTokenSignedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseAlg() * @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseAlg()
*/ */
public JWEAlgorithm getIdTokenEncryptedResponseAlg() { public JWEAlgorithm getIdTokenEncryptedResponseAlg() {
return client.getIdTokenEncryptedResponseAlg(); return client.getIdTokenEncryptedResponseAlg();
} }
/** /**
* @param idTokenEncryptedResponseAlg * @param idTokenEncryptedResponseAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseAlg(com.nimbusds.jose.JWEAlgorithm) * @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseAlg(com.nimbusds.jose.JWEAlgorithm)
*/ */
public void setIdTokenEncryptedResponseAlg(JWEAlgorithm idTokenEncryptedResponseAlg) { public void setIdTokenEncryptedResponseAlg(JWEAlgorithm idTokenEncryptedResponseAlg) {
client.setIdTokenEncryptedResponseAlg(idTokenEncryptedResponseAlg); client.setIdTokenEncryptedResponseAlg(idTokenEncryptedResponseAlg);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseEnc() * @see org.mitre.oauth2.model.ClientDetailsEntity#getIdTokenEncryptedResponseEnc()
*/ */
public EncryptionMethod getIdTokenEncryptedResponseEnc() { public EncryptionMethod getIdTokenEncryptedResponseEnc() {
return client.getIdTokenEncryptedResponseEnc(); return client.getIdTokenEncryptedResponseEnc();
} }
/** /**
* @param idTokenEncryptedResponseEnc * @param idTokenEncryptedResponseEnc
* @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseEnc(com.nimbusds.jose.EncryptionMethod) * @see org.mitre.oauth2.model.ClientDetailsEntity#setIdTokenEncryptedResponseEnc(com.nimbusds.jose.EncryptionMethod)
*/ */
public void setIdTokenEncryptedResponseEnc(EncryptionMethod idTokenEncryptedResponseEnc) { public void setIdTokenEncryptedResponseEnc(EncryptionMethod idTokenEncryptedResponseEnc) {
client.setIdTokenEncryptedResponseEnc(idTokenEncryptedResponseEnc); client.setIdTokenEncryptedResponseEnc(idTokenEncryptedResponseEnc);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getTokenEndpointAuthSigningAlgEmbed() * @see org.mitre.oauth2.model.ClientDetailsEntity#getTokenEndpointAuthSigningAlgEmbed()
*/ */
public JWSAlgorithmEmbed getTokenEndpointAuthSigningAlgEmbed() { public JWSAlgorithmEmbed getTokenEndpointAuthSigningAlgEmbed() {
return client.getTokenEndpointAuthSigningAlgEmbed(); return client.getTokenEndpointAuthSigningAlgEmbed();
} }
/** /**
* @param tokenEndpointAuthSigningAlgEmbed * @param tokenEndpointAuthSigningAlgEmbed
* @see org.mitre.oauth2.model.ClientDetailsEntity#setTokenEndpointAuthSigningAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed) * @see org.mitre.oauth2.model.ClientDetailsEntity#setTokenEndpointAuthSigningAlgEmbed(org.mitre.jose.JWSAlgorithmEmbed)
*/ */
public void setTokenEndpointAuthSigningAlgEmbed(JWSAlgorithmEmbed tokenEndpointAuthSigningAlgEmbed) { public void setTokenEndpointAuthSigningAlgEmbed(JWSAlgorithmEmbed tokenEndpointAuthSigningAlgEmbed) {
client.setTokenEndpointAuthSigningAlgEmbed(tokenEndpointAuthSigningAlgEmbed); client.setTokenEndpointAuthSigningAlgEmbed(tokenEndpointAuthSigningAlgEmbed);
} }
/** /**
* @return * @return
* @see org.mitre.oauth2.model.ClientDetailsEntity#getTokenEndpointAuthSigningAlg() * @see org.mitre.oauth2.model.ClientDetailsEntity#getTokenEndpointAuthSigningAlg()
*/ */
public JWSAlgorithm getTokenEndpointAuthSigningAlg() { public JWSAlgorithm getTokenEndpointAuthSigningAlg() {
return client.getTokenEndpointAuthSigningAlg(); return client.getTokenEndpointAuthSigningAlg();
} }
/** /**
* @param tokenEndpointAuthSigningAlg * @param tokenEndpointAuthSigningAlg
* @see org.mitre.oauth2.model.ClientDetailsEntity#setTokenEndpointAuthSigningAlg(com.nimbusds.jose.JWSAlgorithm) * @see org.mitre.oauth2.model.ClientDetailsEntity#setTokenEndpointAuthSigningAlg(com.nimbusds.jose.JWSAlgorithm)
*/ */
public void setTokenEndpointAuthSigningAlg(JWSAlgorithm tokenEndpointAuthSigningAlg) { public void setTokenEndpointAuthSigningAlg(JWSAlgorithm tokenEndpointAuthSigningAlg) {
client.setTokenEndpointAuthSigningAlg(tokenEndpointAuthSigningAlg); client.setTokenEndpointAuthSigningAlg(tokenEndpointAuthSigningAlg);
} }
/** /**
* @return * @return

View File

@ -204,98 +204,98 @@ public class SystemScope {
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + (allowDynReg ? 1231 : 1237); result = prime * result + (allowDynReg ? 1231 : 1237);
result = prime * result + (defaultScope ? 1231 : 1237); result = prime * result + (defaultScope ? 1231 : 1237);
result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((icon == null) ? 0 : icon.hashCode()); result = prime * result + ((icon == null) ? 0 : icon.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + (structured ? 1231 : 1237); result = prime * result + (structured ? 1231 : 1237);
result = prime * result + ((structuredParamDescription == null) ? 0 : structuredParamDescription.hashCode()); result = prime * result + ((structuredParamDescription == null) ? 0 : structuredParamDescription.hashCode());
result = prime * result + ((structuredValue == null) ? 0 : structuredValue.hashCode()); result = prime * result + ((structuredValue == null) ? 0 : structuredValue.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode());
return result; return result;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!(obj instanceof SystemScope)) { if (!(obj instanceof SystemScope)) {
return false; return false;
} }
SystemScope other = (SystemScope) obj; SystemScope other = (SystemScope) obj;
if (allowDynReg != other.allowDynReg) { if (allowDynReg != other.allowDynReg) {
return false; return false;
} }
if (defaultScope != other.defaultScope) { if (defaultScope != other.defaultScope) {
return false; return false;
} }
if (description == null) { if (description == null) {
if (other.description != null) { if (other.description != null) {
return false; return false;
} }
} else if (!description.equals(other.description)) { } else if (!description.equals(other.description)) {
return false; return false;
} }
if (icon == null) { if (icon == null) {
if (other.icon != null) { if (other.icon != null) {
return false; return false;
} }
} else if (!icon.equals(other.icon)) { } else if (!icon.equals(other.icon)) {
return false; return false;
} }
if (id == null) { if (id == null) {
if (other.id != null) { if (other.id != null) {
return false; return false;
} }
} else if (!id.equals(other.id)) { } else if (!id.equals(other.id)) {
return false; return false;
} }
if (structured != other.structured) { if (structured != other.structured) {
return false; return false;
} }
if (structuredParamDescription == null) { if (structuredParamDescription == null) {
if (other.structuredParamDescription != null) { if (other.structuredParamDescription != null) {
return false; return false;
} }
} else if (!structuredParamDescription.equals(other.structuredParamDescription)) { } else if (!structuredParamDescription.equals(other.structuredParamDescription)) {
return false; return false;
} }
if (structuredValue == null) { if (structuredValue == null) {
if (other.structuredValue != null) { if (other.structuredValue != null) {
return false; return false;
} }
} else if (!structuredValue.equals(other.structuredValue)) { } else if (!structuredValue.equals(other.structuredValue)) {
return false; return false;
} }
if (value == null) { if (value == null) {
if (other.value != null) { if (other.value != null) {
return false; return false;
} }
} else if (!value.equals(other.value)) { } else if (!value.equals(other.value)) {
return false; return false;
} }
return true; return true;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
@Override @Override
public String toString() { public String toString() {
return "SystemScope [id=" + id + ", value=" + value + ", description=" + description + ", icon=" + icon + ", allowDynReg=" + allowDynReg + ", defaultScope=" + defaultScope + ", structured=" + structured + ", structuredParamDescription=" + structuredParamDescription + ", structuredValue=" return "SystemScope [id=" + id + ", value=" + value + ", description=" + description + ", icon=" + icon + ", allowDynReg=" + allowDynReg + ", defaultScope=" + defaultScope + ", structured=" + structured + ", structuredParamDescription=" + structuredParamDescription + ", structuredValue="
+ structuredValue + "]"; + structuredValue + "]";
} }
} }

View File

@ -20,6 +20,14 @@
package org.mitre.openid.connect; package org.mitre.openid.connect;
import static org.mitre.discovery.util.JsonUtils.getAsArray;
import static org.mitre.discovery.util.JsonUtils.getAsDate;
import static org.mitre.discovery.util.JsonUtils.getAsJweAlgorithm;
import static org.mitre.discovery.util.JsonUtils.getAsJweEncryptionMethod;
import static org.mitre.discovery.util.JsonUtils.getAsJwsAlgorithm;
import static org.mitre.discovery.util.JsonUtils.getAsString;
import static org.mitre.discovery.util.JsonUtils.getAsStringSet;
import org.mitre.oauth2.model.ClientDetailsEntity; import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.ClientDetailsEntity.AppType; import org.mitre.oauth2.model.ClientDetailsEntity.AppType;
import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod; import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod;
@ -33,8 +41,6 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import static org.mitre.discovery.util.JsonUtils.*;
/** /**
* @author jricher * @author jricher
* *

View File

@ -149,85 +149,85 @@ public class Address {
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((country == null) ? 0 : country.hashCode()); result = prime * result + ((country == null) ? 0 : country.hashCode());
result = prime * result + ((formatted == null) ? 0 : formatted.hashCode()); result = prime * result + ((formatted == null) ? 0 : formatted.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((locality == null) ? 0 : locality.hashCode()); result = prime * result + ((locality == null) ? 0 : locality.hashCode());
result = prime * result + ((postalCode == null) ? 0 : postalCode.hashCode()); result = prime * result + ((postalCode == null) ? 0 : postalCode.hashCode());
result = prime * result + ((region == null) ? 0 : region.hashCode()); result = prime * result + ((region == null) ? 0 : region.hashCode());
result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode()); result = prime * result + ((streetAddress == null) ? 0 : streetAddress.hashCode());
return result; return result;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!(obj instanceof Address)) { if (!(obj instanceof Address)) {
return false; return false;
} }
Address other = (Address) obj; Address other = (Address) obj;
if (country == null) { if (country == null) {
if (other.country != null) { if (other.country != null) {
return false; return false;
} }
} else if (!country.equals(other.country)) { } else if (!country.equals(other.country)) {
return false; return false;
} }
if (formatted == null) { if (formatted == null) {
if (other.formatted != null) { if (other.formatted != null) {
return false; return false;
} }
} else if (!formatted.equals(other.formatted)) { } else if (!formatted.equals(other.formatted)) {
return false; return false;
} }
if (id == null) { if (id == null) {
if (other.id != null) { if (other.id != null) {
return false; return false;
} }
} else if (!id.equals(other.id)) { } else if (!id.equals(other.id)) {
return false; return false;
} }
if (locality == null) { if (locality == null) {
if (other.locality != null) { if (other.locality != null) {
return false; return false;
} }
} else if (!locality.equals(other.locality)) { } else if (!locality.equals(other.locality)) {
return false; return false;
} }
if (postalCode == null) { if (postalCode == null) {
if (other.postalCode != null) { if (other.postalCode != null) {
return false; return false;
} }
} else if (!postalCode.equals(other.postalCode)) { } else if (!postalCode.equals(other.postalCode)) {
return false; return false;
} }
if (region == null) { if (region == null) {
if (other.region != null) { if (other.region != null) {
return false; return false;
} }
} else if (!region.equals(other.region)) { } else if (!region.equals(other.region)) {
return false; return false;
} }
if (streetAddress == null) { if (streetAddress == null) {
if (other.streetAddress != null) { if (other.streetAddress != null) {
return false; return false;
} }
} else if (!streetAddress.equals(other.streetAddress)) { } else if (!streetAddress.equals(other.streetAddress)) {
return false; return false;
} }
return true; return true;
} }
} }

View File

@ -336,19 +336,19 @@ public class DefaultUserInfo implements UserInfo {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.openid.connect.model.UserInfo#getPhoneNumberVerified() * @see org.mitre.openid.connect.model.UserInfo#getPhoneNumberVerified()
*/ */
@Override @Override
@Basic @Basic
@Column(name="phone_number_verified") @Column(name="phone_number_verified")
public Boolean getPhoneNumberVerified() { public Boolean getPhoneNumberVerified() {
return phoneNumberVerified; return phoneNumberVerified;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.openid.connect.model.UserInfo#setPhoneNumberVerified(java.lang.Boolean) * @see org.mitre.openid.connect.model.UserInfo#setPhoneNumberVerified(java.lang.Boolean)
*/ */
@Override @Override
public void setPhoneNumberVerified(Boolean phoneNumberVerified) { public void setPhoneNumberVerified(Boolean phoneNumberVerified) {
this.phoneNumberVerified = phoneNumberVerified; this.phoneNumberVerified = phoneNumberVerified;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.openid.connect.model.UserInfo#getAddress() * @see org.mitre.openid.connect.model.UserInfo#getAddress()
*/ */
@ -494,197 +494,197 @@ public class DefaultUserInfo implements UserInfo {
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#hashCode() * @see java.lang.Object#hashCode()
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode()); result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((birthdate == null) ? 0 : birthdate.hashCode()); result = prime * result + ((birthdate == null) ? 0 : birthdate.hashCode());
result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode());
result = prime * result + ((emailVerified == null) ? 0 : emailVerified.hashCode()); result = prime * result + ((emailVerified == null) ? 0 : emailVerified.hashCode());
result = prime * result + ((familyName == null) ? 0 : familyName.hashCode()); result = prime * result + ((familyName == null) ? 0 : familyName.hashCode());
result = prime * result + ((gender == null) ? 0 : gender.hashCode()); result = prime * result + ((gender == null) ? 0 : gender.hashCode());
result = prime * result + ((givenName == null) ? 0 : givenName.hashCode()); result = prime * result + ((givenName == null) ? 0 : givenName.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((locale == null) ? 0 : locale.hashCode()); result = prime * result + ((locale == null) ? 0 : locale.hashCode());
result = prime * result + ((middleName == null) ? 0 : middleName.hashCode()); result = prime * result + ((middleName == null) ? 0 : middleName.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + ((nickname == null) ? 0 : nickname.hashCode()); result = prime * result + ((nickname == null) ? 0 : nickname.hashCode());
result = prime * result + ((phoneNumber == null) ? 0 : phoneNumber.hashCode()); result = prime * result + ((phoneNumber == null) ? 0 : phoneNumber.hashCode());
result = prime * result + ((phoneNumberVerified == null) ? 0 : phoneNumberVerified.hashCode()); result = prime * result + ((phoneNumberVerified == null) ? 0 : phoneNumberVerified.hashCode());
result = prime * result + ((picture == null) ? 0 : picture.hashCode()); result = prime * result + ((picture == null) ? 0 : picture.hashCode());
result = prime * result + ((preferredUsername == null) ? 0 : preferredUsername.hashCode()); result = prime * result + ((preferredUsername == null) ? 0 : preferredUsername.hashCode());
result = prime * result + ((profile == null) ? 0 : profile.hashCode()); result = prime * result + ((profile == null) ? 0 : profile.hashCode());
result = prime * result + ((sub == null) ? 0 : sub.hashCode()); result = prime * result + ((sub == null) ? 0 : sub.hashCode());
result = prime * result + ((updatedTime == null) ? 0 : updatedTime.hashCode()); result = prime * result + ((updatedTime == null) ? 0 : updatedTime.hashCode());
result = prime * result + ((website == null) ? 0 : website.hashCode()); result = prime * result + ((website == null) ? 0 : website.hashCode());
result = prime * result + ((zoneinfo == null) ? 0 : zoneinfo.hashCode()); result = prime * result + ((zoneinfo == null) ? 0 : zoneinfo.hashCode());
return result; return result;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!(obj instanceof DefaultUserInfo)) { if (!(obj instanceof DefaultUserInfo)) {
return false; return false;
} }
DefaultUserInfo other = (DefaultUserInfo) obj; DefaultUserInfo other = (DefaultUserInfo) obj;
if (address == null) { if (address == null) {
if (other.address != null) { if (other.address != null) {
return false; return false;
} }
} else if (!address.equals(other.address)) { } else if (!address.equals(other.address)) {
return false; return false;
} }
if (birthdate == null) { if (birthdate == null) {
if (other.birthdate != null) { if (other.birthdate != null) {
return false; return false;
} }
} else if (!birthdate.equals(other.birthdate)) { } else if (!birthdate.equals(other.birthdate)) {
return false; return false;
} }
if (email == null) { if (email == null) {
if (other.email != null) { if (other.email != null) {
return false; return false;
} }
} else if (!email.equals(other.email)) { } else if (!email.equals(other.email)) {
return false; return false;
} }
if (emailVerified == null) { if (emailVerified == null) {
if (other.emailVerified != null) { if (other.emailVerified != null) {
return false; return false;
} }
} else if (!emailVerified.equals(other.emailVerified)) { } else if (!emailVerified.equals(other.emailVerified)) {
return false; return false;
} }
if (familyName == null) { if (familyName == null) {
if (other.familyName != null) { if (other.familyName != null) {
return false; return false;
} }
} else if (!familyName.equals(other.familyName)) { } else if (!familyName.equals(other.familyName)) {
return false; return false;
} }
if (gender == null) { if (gender == null) {
if (other.gender != null) { if (other.gender != null) {
return false; return false;
} }
} else if (!gender.equals(other.gender)) { } else if (!gender.equals(other.gender)) {
return false; return false;
} }
if (givenName == null) { if (givenName == null) {
if (other.givenName != null) { if (other.givenName != null) {
return false; return false;
} }
} else if (!givenName.equals(other.givenName)) { } else if (!givenName.equals(other.givenName)) {
return false; return false;
} }
if (id == null) { if (id == null) {
if (other.id != null) { if (other.id != null) {
return false; return false;
} }
} else if (!id.equals(other.id)) { } else if (!id.equals(other.id)) {
return false; return false;
} }
if (locale == null) { if (locale == null) {
if (other.locale != null) { if (other.locale != null) {
return false; return false;
} }
} else if (!locale.equals(other.locale)) { } else if (!locale.equals(other.locale)) {
return false; return false;
} }
if (middleName == null) { if (middleName == null) {
if (other.middleName != null) { if (other.middleName != null) {
return false; return false;
} }
} else if (!middleName.equals(other.middleName)) { } else if (!middleName.equals(other.middleName)) {
return false; return false;
} }
if (name == null) { if (name == null) {
if (other.name != null) { if (other.name != null) {
return false; return false;
} }
} else if (!name.equals(other.name)) { } else if (!name.equals(other.name)) {
return false; return false;
} }
if (nickname == null) { if (nickname == null) {
if (other.nickname != null) { if (other.nickname != null) {
return false; return false;
} }
} else if (!nickname.equals(other.nickname)) { } else if (!nickname.equals(other.nickname)) {
return false; return false;
} }
if (phoneNumber == null) { if (phoneNumber == null) {
if (other.phoneNumber != null) { if (other.phoneNumber != null) {
return false; return false;
} }
} else if (!phoneNumber.equals(other.phoneNumber)) { } else if (!phoneNumber.equals(other.phoneNumber)) {
return false; return false;
} }
if (phoneNumberVerified == null) { if (phoneNumberVerified == null) {
if (other.phoneNumberVerified != null) { if (other.phoneNumberVerified != null) {
return false; return false;
} }
} else if (!phoneNumberVerified.equals(other.phoneNumberVerified)) { } else if (!phoneNumberVerified.equals(other.phoneNumberVerified)) {
return false; return false;
} }
if (picture == null) { if (picture == null) {
if (other.picture != null) { if (other.picture != null) {
return false; return false;
} }
} else if (!picture.equals(other.picture)) { } else if (!picture.equals(other.picture)) {
return false; return false;
} }
if (preferredUsername == null) { if (preferredUsername == null) {
if (other.preferredUsername != null) { if (other.preferredUsername != null) {
return false; return false;
} }
} else if (!preferredUsername.equals(other.preferredUsername)) { } else if (!preferredUsername.equals(other.preferredUsername)) {
return false; return false;
} }
if (profile == null) { if (profile == null) {
if (other.profile != null) { if (other.profile != null) {
return false; return false;
} }
} else if (!profile.equals(other.profile)) { } else if (!profile.equals(other.profile)) {
return false; return false;
} }
if (sub == null) { if (sub == null) {
if (other.sub != null) { if (other.sub != null) {
return false; return false;
} }
} else if (!sub.equals(other.sub)) { } else if (!sub.equals(other.sub)) {
return false; return false;
} }
if (updatedTime == null) { if (updatedTime == null) {
if (other.updatedTime != null) { if (other.updatedTime != null) {
return false; return false;
} }
} else if (!updatedTime.equals(other.updatedTime)) { } else if (!updatedTime.equals(other.updatedTime)) {
return false; return false;
} }
if (website == null) { if (website == null) {
if (other.website != null) { if (other.website != null) {
return false; return false;
} }
} else if (!website.equals(other.website)) { } else if (!website.equals(other.website)) {
return false; return false;
} }
if (zoneinfo == null) { if (zoneinfo == null) {
if (other.zoneinfo != null) { if (other.zoneinfo != null) {
return false; return false;
} }
} else if (!zoneinfo.equals(other.zoneinfo)) { } else if (!zoneinfo.equals(other.zoneinfo)) {
return false; return false;
} }
return true; return true;
} }
} }

View File

@ -18,13 +18,13 @@ public interface PairwiseIdentifierRepository {
* @param sectorIdentifierUri * @param sectorIdentifierUri
* @return * @return
*/ */
public PairwiseIdentifier getBySectorIdentifier(String sub, String sectorIdentifierUri); public PairwiseIdentifier getBySectorIdentifier(String sub, String sectorIdentifierUri);
/** /**
* Save a pairwise identifier to the database. * Save a pairwise identifier to the database.
* *
* @param pairwise * @param pairwise
*/ */
public void save(PairwiseIdentifier pairwise); public void save(PairwiseIdentifier pairwise);
} }

View File

@ -21,6 +21,6 @@ public interface PairwiseIdentiferService {
* @param client * @param client
* @return * @return
*/ */
public String getIdentifier(UserInfo userInfo, ClientDetailsEntity client); public String getIdentifier(UserInfo userInfo, ClientDetailsEntity client);
} }

View File

@ -51,13 +51,13 @@ import com.google.gson.JsonSerializer;
public class UserInfoInterceptor extends HandlerInterceptorAdapter { public class UserInfoInterceptor extends HandlerInterceptorAdapter {
private Gson gson = new GsonBuilder() private Gson gson = new GsonBuilder()
.registerTypeHierarchyAdapter(GrantedAuthority.class, new JsonSerializer<GrantedAuthority>() { .registerTypeHierarchyAdapter(GrantedAuthority.class, new JsonSerializer<GrantedAuthority>() {
@Override @Override
public JsonElement serialize(GrantedAuthority src, Type typeOfSrc, JsonSerializationContext context) { public JsonElement serialize(GrantedAuthority src, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(src.getAuthority()); return new JsonPrimitive(src.getAuthority());
} }
}) })
.create(); .create();
@Autowired @Autowired
private UserInfoService userInfoService; private UserInfoService userInfoService;
@ -66,7 +66,7 @@ public class UserInfoInterceptor extends HandlerInterceptorAdapter {
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
if (modelAndView != null && !modelAndView.getModel().containsKey("userInfo")) { // skip checking at all if we have no model and view to hand the user to if (modelAndView != null && !modelAndView.getModel().containsKey("userInfo")) { // skip checking at all if we have no model and view to hand the user to
// or if there's already a userInfo object in there // or if there's already a userInfo object in there
// TODO: this is a patch to get around a potential information leak from #492 // TODO: this is a patch to get around a potential information leak from #492
if (!(modelAndView.getView() instanceof RedirectView)) { if (!(modelAndView.getView() instanceof RedirectView)) {

View File

@ -28,12 +28,12 @@ import javax.persistence.EntityManager;
public class JpaUtil { public class JpaUtil {
public static <T> T getSingleResult(List<T> list) { public static <T> T getSingleResult(List<T> list) {
switch(list.size()) { switch(list.size()) {
case 0: case 0:
return null; return null;
case 1: case 1:
return list.get(0); return list.get(0);
default: default:
throw new IllegalStateException("Expected single result, got " + list.size()); throw new IllegalStateException("Expected single result, got " + list.size());
} }
} }

View File

@ -16,13 +16,13 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.discovery.util; package org.mitre.discovery.util;
import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Test;
import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponents;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import static org.junit.Assert.assertEquals;
/** /**
* @author wkim * @author wkim
* *

View File

@ -19,14 +19,14 @@
*/ */
package org.mitre.jose; package org.mitre.jose;
import static org.junit.Assert.assertEquals;
import org.junit.Test; import org.junit.Test;
import com.nimbusds.jose.EncryptionMethod; import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JWEAlgorithm; import com.nimbusds.jose.JWEAlgorithm;
import com.nimbusds.jose.JWSAlgorithm; import com.nimbusds.jose.JWSAlgorithm;
import static org.junit.Assert.assertEquals;
/** /**
* *
* These tests make sure that the algorithm name processing * These tests make sure that the algorithm name processing

View File

@ -76,19 +76,19 @@ public class TestDefaultJwtEncryptionAndDecryptionService {
"YgyD3JR_MB_4NUJW_TqOQtwHYbxevoJArm-L5StowjzGy-_bq6Gw"), // n "YgyD3JR_MB_4NUJW_TqOQtwHYbxevoJArm-L5StowjzGy-_bq6Gw"), // n
new Base64URL("AQAB"), // e new Base64URL("AQAB"), // e
new Base64URL("kLdtIj6GbDks_ApCSTYQtelcNttlKiOyPzMrXHeI-yk1F7-kpDxY4-WY5N" + new Base64URL("kLdtIj6GbDks_ApCSTYQtelcNttlKiOyPzMrXHeI-yk1F7-kpDxY4-WY5N" +
"WV5KntaEeXS1j82E375xxhWMHXyvjYecPT9fpwR_M9gV8n9Hrh2anTpTD9" + "WV5KntaEeXS1j82E375xxhWMHXyvjYecPT9fpwR_M9gV8n9Hrh2anTpTD9" +
"3Dt62ypW3yDsJzBnTnrYu1iwWRgBKrEYY46qAZIrA2xAwnm2X7uGR1hghk" + "3Dt62ypW3yDsJzBnTnrYu1iwWRgBKrEYY46qAZIrA2xAwnm2X7uGR1hghk" +
"qDp0Vqj3kbSCz1XyfCs6_LehBwtxHIyh8Ripy40p24moOAbgxVw3rxT_vl" + "qDp0Vqj3kbSCz1XyfCs6_LehBwtxHIyh8Ripy40p24moOAbgxVw3rxT_vl" +
"t3UVe4WO3JkJOzlpUf-KTVI2Ptgm-dARxTEtE-id-4OJr0h-K-VFs3VSnd" + "t3UVe4WO3JkJOzlpUf-KTVI2Ptgm-dARxTEtE-id-4OJr0h-K-VFs3VSnd" +
"VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d "VTIznSxfyrj8ILL6MG_Uv8YAu7VILSB3lOW085-4qE3DzgrTjgyQ"), // d
Use.ENCRYPTION, JWEAlgorithm.RSA_OAEP, RSAkid, null, null, null); Use.ENCRYPTION, JWEAlgorithm.RSA_OAEP, RSAkid, null, null, null);
// AES key wrap not yet tested // AES key wrap not yet tested
// private String AESkid = "aes123"; // private String AESkid = "aes123";
// private JWK AESjwk = new OctetSequenceKey(new Base64URL("GawgguFyGrWKav7AX4VKUg"), Use.ENCRYPTION, JWEAlgorithm.A128KW, AESkid); // private JWK AESjwk = new OctetSequenceKey(new Base64URL("GawgguFyGrWKav7AX4VKUg"), Use.ENCRYPTION, JWEAlgorithm.A128KW, AESkid);
// //
// private Map<String, JWK> keys = new ImmutableMap.Builder<String, JWK>(). // private Map<String, JWK> keys = new ImmutableMap.Builder<String, JWK>().
// put(RSAkid, RSAjwk).put(AESkid, AESjwk).build(); // put(RSAkid, RSAjwk).put(AESkid, AESjwk).build();
private Map<String, JWK> keys = new ImmutableMap.Builder<String, JWK>(). private Map<String, JWK> keys = new ImmutableMap.Builder<String, JWK>().
put(RSAkid, RSAjwk).build(); put(RSAkid, RSAjwk).build();

View File

@ -19,18 +19,16 @@
*/ */
package org.mitre.oauth2.model; package org.mitre.oauth2.model;
import static org.junit.Assert.assertEquals;
import java.util.Date; import java.util.Date;
import org.junit.Test; import org.junit.Test;
import org.mitre.jose.JWEAlgorithmEmbed;
import org.mitre.jose.JWEEncryptionMethodEmbed;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.nimbusds.jose.EncryptionMethod; import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JWEAlgorithm; import com.nimbusds.jose.JWEAlgorithm;
import static org.junit.Assert.assertEquals;
/** /**
* @author jricher * @author jricher
* *

View File

@ -19,18 +19,16 @@
*/ */
package org.mitre.oauth2.model; package org.mitre.oauth2.model;
import static org.junit.Assert.assertEquals;
import java.sql.Date; import java.sql.Date;
import org.junit.Test; import org.junit.Test;
import org.mitre.jose.JWEAlgorithmEmbed;
import org.mitre.jose.JWEEncryptionMethodEmbed;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.nimbusds.jose.EncryptionMethod; import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JWEAlgorithm; import com.nimbusds.jose.JWEAlgorithm;
import static org.junit.Assert.assertEquals;
/** /**
* @author jricher * @author jricher
* *

View File

@ -19,11 +19,12 @@
*/ */
package org.mitre.openid.connect; package org.mitre.openid.connect;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.sql.Date; import java.sql.Date;
import org.junit.Test; import org.junit.Test;
import org.mitre.jose.JWEAlgorithmEmbed;
import org.mitre.jose.JWEEncryptionMethodEmbed;
import org.mitre.oauth2.model.ClientDetailsEntity; import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.RegisteredClient; import org.mitre.oauth2.model.RegisteredClient;
@ -33,9 +34,6 @@ import com.google.gson.JsonObject;
import com.nimbusds.jose.EncryptionMethod; import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JWEAlgorithm; import com.nimbusds.jose.JWEAlgorithm;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/** /**
* @author jricher * @author jricher
* *

View File

@ -19,10 +19,10 @@
*/ */
package org.mitre.openid.connect.config; package org.mitre.openid.connect.config;
import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.junit.Test;
/** /**
* @author jricher * @author jricher
* *

View File

@ -19,11 +19,11 @@
*/ */
package org.mitre.openid.connect.config; package org.mitre.openid.connect.config;
import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import org.junit.Test;
/** /**
* @author jricher * @author jricher
* *

View File

@ -117,19 +117,19 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
// check the sector URI // check the sector URI
if (!Strings.isNullOrEmpty(client.getSectorIdentifierUri())) { if (!Strings.isNullOrEmpty(client.getSectorIdentifierUri())) {
try { try {
List<String> redirects = sectorRedirects.get(client.getSectorIdentifierUri()); List<String> redirects = sectorRedirects.get(client.getSectorIdentifierUri());
if (client.getRegisteredRedirectUri() != null) { if (client.getRegisteredRedirectUri() != null) {
for (String uri : client.getRegisteredRedirectUri()) { for (String uri : client.getRegisteredRedirectUri()) {
if (!redirects.contains(uri)) { if (!redirects.contains(uri)) {
throw new IllegalArgumentException("Requested Redirect URI " + uri + " is not listed at sector identifier " + redirects); throw new IllegalArgumentException("Requested Redirect URI " + uri + " is not listed at sector identifier " + redirects);
} }
} }
} }
} catch (ExecutionException e) { } catch (ExecutionException e) {
throw new IllegalArgumentException("Unable to load sector identifier URI: " + client.getSectorIdentifierUri()); throw new IllegalArgumentException("Unable to load sector identifier URI: " + client.getSectorIdentifierUri());
} }
} }
@ -218,19 +218,19 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
// check the sector URI // check the sector URI
if (!Strings.isNullOrEmpty(newClient.getSectorIdentifierUri())) { if (!Strings.isNullOrEmpty(newClient.getSectorIdentifierUri())) {
try { try {
List<String> redirects = sectorRedirects.get(newClient.getSectorIdentifierUri()); List<String> redirects = sectorRedirects.get(newClient.getSectorIdentifierUri());
if (newClient.getRegisteredRedirectUri() != null) { if (newClient.getRegisteredRedirectUri() != null) {
for (String uri : newClient.getRegisteredRedirectUri()) { for (String uri : newClient.getRegisteredRedirectUri()) {
if (!redirects.contains(uri)) { if (!redirects.contains(uri)) {
throw new IllegalArgumentException("Requested Redirect URI " + uri + " is not listed at sector identifier " + redirects); throw new IllegalArgumentException("Requested Redirect URI " + uri + " is not listed at sector identifier " + redirects);
} }
} }
} }
} catch (ExecutionException e) { } catch (ExecutionException e) {
throw new IllegalArgumentException("Unable to load sector identifier URI: " + newClient.getSectorIdentifierUri()); throw new IllegalArgumentException("Unable to load sector identifier URI: " + newClient.getSectorIdentifierUri());
} }
} }
// make sure a client doesn't get any special system scopes // make sure a client doesn't get any special system scopes
@ -270,32 +270,32 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
/** /**
* Utility class to load a sector identifier's set of authorized redirect URIs. * Utility class to load a sector identifier's set of authorized redirect URIs.
* *
* @author jricher * @author jricher
* *
*/ */
private class SectorIdentifierLoader extends CacheLoader<String, List<String>> { private class SectorIdentifierLoader extends CacheLoader<String, List<String>> {
private HttpClient httpClient = new DefaultHttpClient(); private HttpClient httpClient = new DefaultHttpClient();
private HttpComponentsClientHttpRequestFactory httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient); private HttpComponentsClientHttpRequestFactory httpFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
private RestTemplate restTemplate = new RestTemplate(httpFactory); private RestTemplate restTemplate = new RestTemplate(httpFactory);
private JsonParser parser = new JsonParser(); private JsonParser parser = new JsonParser();
@Override @Override
public List<String> load(String key) throws Exception { public List<String> load(String key) throws Exception {
if (!key.startsWith("https")) { if (!key.startsWith("https")) {
// TODO: this should optionally throw an error (#506) // TODO: this should optionally throw an error (#506)
logger.error("Sector identifier doesn't start with https, loading anyway..."); logger.error("Sector identifier doesn't start with https, loading anyway...");
} }
// key is the sector URI // key is the sector URI
String jsonString = restTemplate.getForObject(key, String.class); String jsonString = restTemplate.getForObject(key, String.class);
JsonElement json = parser.parse(jsonString); JsonElement json = parser.parse(jsonString);
if (json.isJsonArray()) { if (json.isJsonArray()) {
List<String> redirectUris = new ArrayList<String>(); List<String> redirectUris = new ArrayList<String>();
for (JsonElement el : json.getAsJsonArray()) { for (JsonElement el : json.getAsJsonArray()) {
redirectUris.add(el.getAsString()); redirectUris.add(el.getAsString());
} }
logger.info("Found " + redirectUris + " for sector " + key); logger.info("Found " + redirectUris + " for sector " + key);
@ -304,8 +304,8 @@ public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEnt
return null; return null;
} }
} }
} }
} }

View File

@ -204,40 +204,40 @@ public class DefaultSystemScopeService implements SystemScopeService {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.oauth2.service.SystemScopeService#scopesMatch(java.util.Set, java.util.Set) * @see org.mitre.oauth2.service.SystemScopeService#scopesMatch(java.util.Set, java.util.Set)
*/ */
@Override @Override
public boolean scopesMatch(Set<String> expected, Set<String> actual) { public boolean scopesMatch(Set<String> expected, Set<String> actual) {
Set<SystemScope> ex = fromStrings(expected); Set<SystemScope> ex = fromStrings(expected);
Set<SystemScope> act = fromStrings(actual); Set<SystemScope> act = fromStrings(actual);
for (SystemScope actScope : act) { for (SystemScope actScope : act) {
// first check to see if there's an exact match // first check to see if there's an exact match
if (!ex.contains(actScope)) { if (!ex.contains(actScope)) {
// we didn't find an exact match // we didn't find an exact match
if (actScope.isStructured() && !Strings.isNullOrEmpty(actScope.getStructuredValue())) { if (actScope.isStructured() && !Strings.isNullOrEmpty(actScope.getStructuredValue())) {
// if we didn't get an exact match but the actual scope is structured, we need to check further // if we didn't get an exact match but the actual scope is structured, we need to check further
// first, find the "base" scope for this // first, find the "base" scope for this
SystemScope base = getByValue(actScope.getValue()); SystemScope base = getByValue(actScope.getValue());
if (!ex.contains(base)) { if (!ex.contains(base)) {
// if the expected doesn't contain the base scope, fail // if the expected doesn't contain the base scope, fail
return false; return false;
} else { } else {
// we did find an exact match, need to check the rest // we did find an exact match, need to check the rest
} }
} else { } else {
// the scope wasn't structured, fail now // the scope wasn't structured, fail now
return false; return false;
} }
} else { } else {
// if we did find an exact match, we need to check the rest // if we did find an exact match, we need to check the rest
} }
} }
// if we got all the way down here, the setup passed // if we got all the way down here, the setup passed
return true; return true;
} }
@Override @Override
public Set<String> removeRestrictedScopes(Set<String> scopes) { public Set<String> removeRestrictedScopes(Set<String> scopes) {

View File

@ -3,13 +3,11 @@
*/ */
package org.mitre.oauth2.token; package org.mitre.oauth2.token;
import java.util.Map;
import java.util.Set; import java.util.Set;
import org.mitre.oauth2.service.SystemScopeService; import org.mitre.oauth2.service.SystemScopeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.common.exceptions.InvalidScopeException; import org.springframework.security.oauth2.common.exceptions.InvalidScopeException;
import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.provider.AuthorizationRequest; import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.ClientDetails; import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.OAuth2RequestValidator; import org.springframework.security.oauth2.provider.OAuth2RequestValidator;

View File

@ -36,9 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException; import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.common.util.OAuth2Utils; import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.provider.AuthorizationRequest; import org.springframework.security.oauth2.provider.AuthorizationRequest;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory; import org.springframework.security.oauth2.provider.DefaultOAuth2RequestFactory;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.google.common.base.Strings; import com.google.common.base.Strings;
@ -321,7 +319,7 @@ public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
String prompt = claims.getStringClaim("prompt"); String prompt = claims.getStringClaim("prompt");
if (prompt != null) { if (prompt != null) {
if (!prompt.equals(request.getExtensions().get("prompt"))) { if (!prompt.equals(request.getExtensions().get("prompt"))) {
logger.info("Mismatch between request object and regular parameter for prompt, using request object"); logger.info("Mismatch between request object and regular parameter for prompt, using request object");
} }
request.getExtensions().put("prompt", prompt); request.getExtensions().put("prompt", prompt);
} }
@ -352,14 +350,14 @@ public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
* @param claimRequestString * @param claimRequestString
* @return * @return
*/ */
private JsonObject parseClaimRequest(String claimRequestString) { private JsonObject parseClaimRequest(String claimRequestString) {
JsonElement el = parser .parse(claimRequestString); JsonElement el = parser .parse(claimRequestString);
if (el != null && el.isJsonObject()) { if (el != null && el.isJsonObject()) {
return el.getAsJsonObject(); return el.getAsJsonObject();
} else { } else {
return null; return null;
} }
} }
/** /**
* Create a symmetric signing and validation service for the given client * Create a symmetric signing and validation service for the given client
@ -367,34 +365,34 @@ public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
* @param client * @param client
* @return * @return
*/ */
private JwtSigningAndValidationService getSymmetricValidtor(ClientDetailsEntity client) { private JwtSigningAndValidationService getSymmetricValidtor(ClientDetailsEntity client) {
if (client == null) { if (client == null) {
logger.error("Couldn't create symmetric validator for null client"); logger.error("Couldn't create symmetric validator for null client");
return null; return null;
} }
if (Strings.isNullOrEmpty(client.getClientSecret())) { if (Strings.isNullOrEmpty(client.getClientSecret())) {
logger.error("Couldn't create symmetric validator for client " + client.getClientId() + " without a client secret"); logger.error("Couldn't create symmetric validator for client " + client.getClientId() + " without a client secret");
return null; return null;
} }
try { try {
JWK jwk = new OctetSequenceKey(Base64URL.encode(client.getClientSecret()), Use.SIGNATURE, null, client.getClientId(), null, null, null); JWK jwk = new OctetSequenceKey(Base64URL.encode(client.getClientSecret()), Use.SIGNATURE, null, client.getClientId(), null, null, null);
Map<String, JWK> keys = ImmutableMap.of(client.getClientId(), jwk); Map<String, JWK> keys = ImmutableMap.of(client.getClientId(), jwk);
JwtSigningAndValidationService service = new DefaultJwtSigningAndValidationService(keys); JwtSigningAndValidationService service = new DefaultJwtSigningAndValidationService(keys);
return service; return service;
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
logger.error("Couldn't create symmetric validator for client " + client.getClientId(), e); logger.error("Couldn't create symmetric validator for client " + client.getClientId(), e);
} catch (InvalidKeySpecException e) { } catch (InvalidKeySpecException e) {
logger.error("Couldn't create symmetric validator for client " + client.getClientId(), e); logger.error("Couldn't create symmetric validator for client " + client.getClientId(), e);
} }
return null; return null;
} }
} }

View File

@ -43,8 +43,6 @@ import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.filter.GenericFilterBean; import org.springframework.web.filter.GenericFilterBean;
import com.google.common.base.Strings;
/** /**
* @author jricher * @author jricher
* *
@ -92,31 +90,31 @@ public class PromptFilter extends GenericFilterBean {
} }
} else if (prompt.equals("login")) { } else if (prompt.equals("login")) {
// first see if the user's already been prompted in this session // first see if the user's already been prompted in this session
HttpSession session = request.getSession(); HttpSession session = request.getSession();
if (session.getAttribute(PROMPTED) == null) { if (session.getAttribute(PROMPTED) == null) {
// user hasn't been PROMPTED yet, we need to check // user hasn't been PROMPTED yet, we need to check
session.setAttribute(PROMPT_REQUESTED, Boolean.TRUE); session.setAttribute(PROMPT_REQUESTED, Boolean.TRUE);
// see if the user's logged in // see if the user's logged in
Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if (auth != null) { if (auth != null) {
// user's been logged in already (by session management) // user's been logged in already (by session management)
// log them out and continue // log them out and continue
SecurityContextHolder.getContext().setAuthentication(null); SecurityContextHolder.getContext().setAuthentication(null);
chain.doFilter(req, res); chain.doFilter(req, res);
} else { } else {
// user hasn't been logged in yet, we can keep going since we'll get there // user hasn't been logged in yet, we can keep going since we'll get there
chain.doFilter(req, res); chain.doFilter(req, res);
} }
} else { } else {
// user has been PROMPTED, we're fine // user has been PROMPTED, we're fine
// but first, undo the prompt tag // but first, undo the prompt tag
session.removeAttribute(PROMPTED); session.removeAttribute(PROMPTED);
chain.doFilter(req, res); chain.doFilter(req, res);
} }
} else { } else {
// prompt parameter is a value we don't care about, not our business // prompt parameter is a value we don't care about, not our business
chain.doFilter(req, res); chain.doFilter(req, res);
@ -133,12 +131,12 @@ public class PromptFilter extends GenericFilterBean {
long seconds = (now.getTime() - authTime.getTime()) / 1000; long seconds = (now.getTime() - authTime.getTime()) / 1000;
if (seconds > max) { if (seconds > max) {
// session is too old, log the user out and continue // session is too old, log the user out and continue
SecurityContextHolder.getContext().setAuthentication(null); SecurityContextHolder.getContext().setAuthentication(null);
} }
} }
chain.doFilter(req, res); chain.doFilter(req, res);
} else { } else {
// no prompt parameter, not our business // no prompt parameter, not our business
chain.doFilter(req, res); chain.doFilter(req, res);
} }
@ -149,16 +147,16 @@ public class PromptFilter extends GenericFilterBean {
* @param parameterMap * @param parameterMap
* @return * @return
*/ */
private Map<String, String> createRequestMap(Map<String, String[]> parameterMap) { private Map<String, String> createRequestMap(Map<String, String[]> parameterMap) {
Map<String, String> requestMap = new HashMap<String, String>(); Map<String, String> requestMap = new HashMap<String, String>();
for (String key : parameterMap.keySet()) { for (String key : parameterMap.keySet()) {
String[] val = parameterMap.get(key); String[] val = parameterMap.get(key);
if (val != null && val.length > 0) { if (val != null && val.length > 0) {
requestMap.put(key, val[0]); // add the first value only (which is what Spring seems to do) requestMap.put(key, val[0]); // add the first value only (which is what Spring seems to do)
} }
} }
return requestMap; return requestMap;
} }
} }

View File

@ -16,6 +16,8 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.repository.impl; package org.mitre.openid.connect.repository.impl;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
@ -24,8 +26,6 @@ import org.mitre.openid.connect.repository.AddressRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
/** /**
* JPA Address repository implementation * JPA Address repository implementation
* *

View File

@ -19,6 +19,8 @@
*/ */
package org.mitre.openid.connect.repository.impl; package org.mitre.openid.connect.repository.impl;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
import java.util.Collection; import java.util.Collection;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
@ -30,8 +32,6 @@ import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
/** /**
* @author jricher * @author jricher
* *

View File

@ -3,6 +3,9 @@
*/ */
package org.mitre.openid.connect.repository.impl; package org.mitre.openid.connect.repository.impl;
import static org.mitre.util.jpa.JpaUtil.getSingleResult;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
@ -12,9 +15,6 @@ import org.mitre.openid.connect.repository.PairwiseIdentifierRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import static org.mitre.util.jpa.JpaUtil.getSingleResult;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
/** /**
* @author jricher * @author jricher
* *

View File

@ -16,6 +16,9 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.repository.impl; package org.mitre.openid.connect.repository.impl;
import static org.mitre.util.jpa.JpaUtil.getSingleResult;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
import java.util.Collection; import java.util.Collection;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
@ -28,9 +31,6 @@ import org.mitre.openid.connect.repository.UserInfoRepository;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import static org.mitre.util.jpa.JpaUtil.getSingleResult;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
/** /**
* JPA UserInfo repository implementation * JPA UserInfo repository implementation
* *

View File

@ -16,6 +16,8 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.repository.impl; package org.mitre.openid.connect.repository.impl;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
import java.util.Collection; import java.util.Collection;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
@ -28,8 +30,6 @@ import org.mitre.util.jpa.JpaUtil;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import static org.mitre.util.jpa.JpaUtil.saveOrUpdate;
/** /**
* JPA WhitelistedSite repository implementation * JPA WhitelistedSite repository implementation
* *

View File

@ -36,7 +36,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request; import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -130,6 +129,7 @@ public class DefaultOIDCTokenService implements OIDCTokenService {
* @return * @return
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Override
public OAuth2AccessTokenEntity createRegistrationAccessToken(ClientDetailsEntity client) { public OAuth2AccessTokenEntity createRegistrationAccessToken(ClientDetailsEntity client) {
Map<String, String> authorizationParameters = Maps.newHashMap(); Map<String, String> authorizationParameters = Maps.newHashMap();

View File

@ -20,96 +20,96 @@ import com.google.common.collect.SetMultimap;
@Service("scopeClaimTranslator") @Service("scopeClaimTranslator")
public class DefaultScopeClaimTranslationService implements ScopeClaimTranslationService { public class DefaultScopeClaimTranslationService implements ScopeClaimTranslationService {
private SetMultimap<String, String> scopesToClaims = HashMultimap.create(); private SetMultimap<String, String> scopesToClaims = HashMultimap.create();
private Map<String, String> claimsToFields = Maps.newHashMap(); private Map<String, String> claimsToFields = Maps.newHashMap();
/** /**
* Default constructor; initializes scopesToClaims map * Default constructor; initializes scopesToClaims map
*/ */
public DefaultScopeClaimTranslationService() { public DefaultScopeClaimTranslationService() {
scopesToClaims.put("openid", "sub"); scopesToClaims.put("openid", "sub");
scopesToClaims.put("profile", "name"); scopesToClaims.put("profile", "name");
scopesToClaims.put("profile", "preferred_username"); scopesToClaims.put("profile", "preferred_username");
scopesToClaims.put("profile", "given_name"); scopesToClaims.put("profile", "given_name");
scopesToClaims.put("profile", "family_name"); scopesToClaims.put("profile", "family_name");
scopesToClaims.put("profile", "middle_name"); scopesToClaims.put("profile", "middle_name");
scopesToClaims.put("profile", "nickname"); scopesToClaims.put("profile", "nickname");
scopesToClaims.put("profile", "profile"); scopesToClaims.put("profile", "profile");
scopesToClaims.put("profile", "picture"); scopesToClaims.put("profile", "picture");
scopesToClaims.put("profile", "website"); scopesToClaims.put("profile", "website");
scopesToClaims.put("profile", "gender"); scopesToClaims.put("profile", "gender");
scopesToClaims.put("profile", "zone_info"); scopesToClaims.put("profile", "zone_info");
scopesToClaims.put("profile", "locale"); scopesToClaims.put("profile", "locale");
scopesToClaims.put("profile", "updated_time"); scopesToClaims.put("profile", "updated_time");
scopesToClaims.put("profile", "birthdate"); scopesToClaims.put("profile", "birthdate");
scopesToClaims.put("email", "email"); scopesToClaims.put("email", "email");
scopesToClaims.put("email", "email_verified"); scopesToClaims.put("email", "email_verified");
scopesToClaims.put("phone", "phone_number"); scopesToClaims.put("phone", "phone_number");
scopesToClaims.put("phone", "phone_number_verified"); scopesToClaims.put("phone", "phone_number_verified");
scopesToClaims.put("address", "address"); scopesToClaims.put("address", "address");
claimsToFields.put("sub", "sub"); claimsToFields.put("sub", "sub");
claimsToFields.put("name", "name"); claimsToFields.put("name", "name");
claimsToFields.put("preferred_username", "preferredUsername"); claimsToFields.put("preferred_username", "preferredUsername");
claimsToFields.put("given_name", "givenName"); claimsToFields.put("given_name", "givenName");
claimsToFields.put("family_name", "familyName"); claimsToFields.put("family_name", "familyName");
claimsToFields.put("middle_name", "middleName"); claimsToFields.put("middle_name", "middleName");
claimsToFields.put("nickname", "nickname"); claimsToFields.put("nickname", "nickname");
claimsToFields.put("profile", "profile"); claimsToFields.put("profile", "profile");
claimsToFields.put("picture", "picture"); claimsToFields.put("picture", "picture");
claimsToFields.put("website", "website"); claimsToFields.put("website", "website");
claimsToFields.put("gender", "gender"); claimsToFields.put("gender", "gender");
claimsToFields.put("zone_info", "zoneinfo"); claimsToFields.put("zone_info", "zoneinfo");
claimsToFields.put("locale", "locale"); claimsToFields.put("locale", "locale");
claimsToFields.put("updated_time", "updatedTime"); claimsToFields.put("updated_time", "updatedTime");
claimsToFields.put("birthdate", "birthdate"); claimsToFields.put("birthdate", "birthdate");
claimsToFields.put("email", "email"); claimsToFields.put("email", "email");
claimsToFields.put("email_verified", "emailVerified"); claimsToFields.put("email_verified", "emailVerified");
claimsToFields.put("phone_number", "phoneNumber"); claimsToFields.put("phone_number", "phoneNumber");
claimsToFields.put("phone_number_verified", "phoneNumberVerified"); claimsToFields.put("phone_number_verified", "phoneNumberVerified");
claimsToFields.put("address", "address"); claimsToFields.put("address", "address");
}
/* (non-Javadoc)
* @see org.mitre.openid.connect.service.ScopeClaimTranslationService#getClaimsForScope(java.lang.String)
*/
@Override
public Set<String> getClaimsForScope(String scope) {
if (scopesToClaims.containsKey(scope)) {
return scopesToClaims.get(scope);
} else {
return new HashSet<String>();
} }
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.openid.connect.service.ScopeClaimTranslationService#getClaimsForScope(java.lang.String) * @see org.mitre.openid.connect.service.ScopeClaimTranslationService#getClaimsForScopeSet(java.util.Set)
*/ */
@Override @Override
public Set<String> getClaimsForScope(String scope) { public Set<String> getClaimsForScopeSet(Set<String> scopes) {
if (scopesToClaims.containsKey(scope)) { Set<String> result = new HashSet<String>();
return scopesToClaims.get(scope); for (String scope : scopes) {
} else { result.addAll(getClaimsForScope(scope));
return new HashSet<String>();
}
} }
return result;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.mitre.openid.connect.service.ScopeClaimTranslationService#getClaimsForScopeSet(java.util.Set) * @see org.mitre.openid.connect.service.ScopeClaimTranslationService#getFieldNameForClaim(java.lang.String)
*/ */
@Override @Override
public Set<String> getClaimsForScopeSet(Set<String> scopes) { public String getFieldNameForClaim(String claim) {
Set<String> result = new HashSet<String>(); return claimsToFields.get(claim);
for (String scope : scopes) { }
result.addAll(getClaimsForScope(scope));
}
return result;
}
/* (non-Javadoc)
* @see org.mitre.openid.connect.service.ScopeClaimTranslationService#getFieldNameForClaim(java.lang.String)
*/
@Override
public String getFieldNameForClaim(String claim) {
return claimsToFields.get(claim);
}
} }

View File

@ -6,7 +6,6 @@ package org.mitre.openid.connect.service.impl;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.apache.http.client.utils.URIBuilder;
import org.mitre.oauth2.model.ClientDetailsEntity; import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.openid.connect.model.PairwiseIdentifier; import org.mitre.openid.connect.model.PairwiseIdentifier;
import org.mitre.openid.connect.model.UserInfo; import org.mitre.openid.connect.model.UserInfo;
@ -35,7 +34,7 @@ public class UUIDPairwiseIdentiferService implements PairwiseIdentiferService {
private PairwiseIdentifierRepository pairwiseIdentifierRepository; private PairwiseIdentifierRepository pairwiseIdentifierRepository;
@Override @Override
public String getIdentifier(UserInfo userInfo, ClientDetailsEntity client) { public String getIdentifier(UserInfo userInfo, ClientDetailsEntity client) {
String sectorIdentifier = null; String sectorIdentifier = null;
@ -68,6 +67,6 @@ public class UUIDPairwiseIdentiferService implements PairwiseIdentiferService {
return null; return null;
} }
} }
} }

View File

@ -110,7 +110,7 @@ public class ConnectTokenEnhancer implements TokenEnhancer {
UserInfo userInfo = userInfoService.getByUsernameAndClientId(username, clientId); UserInfo userInfo = userInfoService.getByUsernameAndClientId(username, clientId);
OAuth2AccessTokenEntity idTokenEntity = connectTokenService.createIdToken(client, OAuth2AccessTokenEntity idTokenEntity = connectTokenService.createIdToken(client,
originalAuthRequest, (java.util.Date) claims.getIssueTime(), originalAuthRequest, claims.getIssueTime(),
userInfo.getSub(), signingAlg, token); userInfo.getSub(), signingAlg, token);
// attach the id token to the parent access token // attach the id token to the parent access token

View File

@ -208,7 +208,7 @@ public class TofuUserApprovalHandler implements UserApprovalHandler {
if (systemScope.isStructured()){ if (systemScope.isStructured()){
String paramValue = approvalParams.get("scopeparam_" + scope); String paramValue = approvalParams.get("scopeparam_" + scope);
allowedScopes.add(scope + ":"+paramValue); allowedScopes.add(scope + ":"+paramValue);
// .. and if it's unstructured, we're all set // .. and if it's unstructured, we're all set
} else { } else {
allowedScopes.add(scope); allowedScopes.add(scope);
} }

View File

@ -20,8 +20,8 @@ import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;

View File

@ -17,12 +17,9 @@
package org.mitre.openid.connect.web; package org.mitre.openid.connect.web;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.client.utils.URLEncodedUtils;
import org.mitre.jwt.signer.service.JwtSigningAndValidationService; import org.mitre.jwt.signer.service.JwtSigningAndValidationService;
import org.mitre.oauth2.model.ClientDetailsEntity; import org.mitre.oauth2.model.ClientDetailsEntity;
import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod; import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod;
@ -42,7 +39,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails; import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
import org.springframework.security.web.util.UrlUtils;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;

View File

@ -16,6 +16,11 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.oauth2.service.impl; package org.mitre.oauth2.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.util.Set; import java.util.Set;
import org.junit.Before; import org.junit.Before;
@ -38,11 +43,6 @@ import org.springframework.security.oauth2.common.exceptions.InvalidClientExcept
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
/** /**
* @author wkim * @author wkim
* *

View File

@ -43,9 +43,7 @@ import org.mockito.InjectMocks;
import org.mockito.Matchers; import org.mockito.Matchers;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer;
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
import org.springframework.security.oauth2.common.exceptions.InvalidClientException; import org.springframework.security.oauth2.common.exceptions.InvalidClientException;
import org.springframework.security.oauth2.common.exceptions.InvalidScopeException; import org.springframework.security.oauth2.common.exceptions.InvalidScopeException;

View File

@ -16,6 +16,11 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.oauth2.service.impl; package org.mitre.oauth2.service.impl;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
import java.util.Set; import java.util.Set;
import org.junit.Before; import org.junit.Before;
@ -32,11 +37,6 @@ import org.mockito.stubbing.Answer;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *
@ -122,11 +122,11 @@ public class TestDefaultSystemScopeService {
// we re-use this value so we've got to use thenAnswer instead // we re-use this value so we've got to use thenAnswer instead
Mockito.when(repository.getByValue(structuredScope1String)).thenAnswer(new Answer<SystemScope>() { Mockito.when(repository.getByValue(structuredScope1String)).thenAnswer(new Answer<SystemScope>() {
@Override @Override
public SystemScope answer(InvocationOnMock invocation) throws Throwable { public SystemScope answer(InvocationOnMock invocation) throws Throwable {
SystemScope s = new SystemScope(structuredScope1String); SystemScope s = new SystemScope(structuredScope1String);
s.setStructured(true); s.setStructured(true);
return s; return s;
} }
}); });
@ -200,11 +200,11 @@ public class TestDefaultSystemScopeService {
// note: we have to use "thenAnswer" here to mimic the repository not serializing the structuredValue field // note: we have to use "thenAnswer" here to mimic the repository not serializing the structuredValue field
Mockito.when(repository.getByValue("foo")).thenAnswer(new Answer<SystemScope>() { Mockito.when(repository.getByValue("foo")).thenAnswer(new Answer<SystemScope>() {
@Override @Override
public SystemScope answer(InvocationOnMock invocation) throws Throwable { public SystemScope answer(InvocationOnMock invocation) throws Throwable {
SystemScope foo = new SystemScope("foo"); SystemScope foo = new SystemScope("foo");
foo.setStructured(true); foo.setStructured(true);
return foo; return foo;
} }
}); });

View File

@ -16,6 +16,10 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -34,10 +38,6 @@ import org.springframework.test.annotation.Rollback;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class TestDefaultApprovedSiteService { public class TestDefaultApprovedSiteService {

View File

@ -16,6 +16,10 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.times;
import java.util.Set; import java.util.Set;
import org.junit.Before; import org.junit.Before;
@ -30,10 +34,6 @@ import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.times;
/** /**
* @author wkim * @author wkim
* *

View File

@ -16,6 +16,9 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
@ -33,9 +36,6 @@ import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/** /**
* @author wkim * @author wkim
* *

View File

@ -3,6 +3,9 @@
*/ */
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -14,15 +17,13 @@ import org.mitre.openid.connect.model.UserInfo;
import org.mitre.openid.connect.repository.UserInfoRepository; import org.mitre.openid.connect.repository.UserInfoRepository;
import org.mitre.openid.connect.service.PairwiseIdentiferService; import org.mitre.openid.connect.service.PairwiseIdentiferService;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
/** /**
* @author jricher * @author jricher
* *
@ -171,7 +172,7 @@ public class TestDefaultUserInfoService {
Mockito.when(userInfoRepository.getByUsername(regularUsername)).thenReturn(userInfoRegular); Mockito.when(userInfoRepository.getByUsername(regularUsername)).thenReturn(userInfoRegular);
Mockito.verify(pairwiseIdentiferService, Mockito.never()).getIdentifier(Mockito.any(UserInfo.class), Mockito.any(ClientDetailsEntity.class)); Mockito.verify(pairwiseIdentiferService, Mockito.never()).getIdentifier(Matchers.any(UserInfo.class), Matchers.any(ClientDetailsEntity.class));
UserInfo user1 = service.getByUsernameAndClientId(regularUsername, publicClientId1); UserInfo user1 = service.getByUsernameAndClientId(regularUsername, publicClientId1);
UserInfo user2 = service.getByUsernameAndClientId(regularUsername, publicClientId2); UserInfo user2 = service.getByUsernameAndClientId(regularUsername, publicClientId2);
@ -192,13 +193,14 @@ public class TestDefaultUserInfoService {
Mockito.when(clientDetailsEntityService.loadClientByClientId(pairwiseClientId4)).thenReturn(pairwiseClient4); Mockito.when(clientDetailsEntityService.loadClientByClientId(pairwiseClientId4)).thenReturn(pairwiseClient4);
Mockito.when(userInfoRepository.getByUsername(regularUsername)).thenAnswer(new Answer<UserInfo>() { Mockito.when(userInfoRepository.getByUsername(regularUsername)).thenAnswer(new Answer<UserInfo>() {
public UserInfo answer(InvocationOnMock invocation) throws Throwable { @Override
UserInfo userInfo = new DefaultUserInfo(); public UserInfo answer(InvocationOnMock invocation) throws Throwable {
userInfo.setPreferredUsername(regularUsername); UserInfo userInfo = new DefaultUserInfo();
userInfo.setSub(regularSub); userInfo.setPreferredUsername(regularUsername);
userInfo.setSub(regularSub);
return userInfo; return userInfo;
} }
}); });
Mockito.when(pairwiseIdentiferService.getIdentifier(userInfoRegular, pairwiseClient1)).thenReturn(pairwiseSub12); Mockito.when(pairwiseIdentiferService.getIdentifier(userInfoRegular, pairwiseClient1)).thenReturn(pairwiseSub12);

View File

@ -16,6 +16,11 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
import java.util.ArrayList; import java.util.ArrayList;
import org.junit.Before; import org.junit.Before;
@ -34,11 +39,6 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.matchers.JUnitMatchers.hasItem;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class TestDefaultUserInfoUserDetailsService { public class TestDefaultUserInfoUserDetailsService {

View File

@ -16,6 +16,11 @@
******************************************************************************/ ******************************************************************************/
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -26,11 +31,6 @@ import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
/** /**
* @author wkim * @author wkim
* *

View File

@ -3,6 +3,9 @@
*/ */
package org.mitre.openid.connect.service.impl; package org.mitre.openid.connect.service.impl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -16,15 +19,13 @@ import org.mitre.openid.connect.model.PairwiseIdentifier;
import org.mitre.openid.connect.model.UserInfo; import org.mitre.openid.connect.model.UserInfo;
import org.mitre.openid.connect.repository.PairwiseIdentifierRepository; import org.mitre.openid.connect.repository.PairwiseIdentifierRepository;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
/** /**
* @author jricher * @author jricher
* *
@ -135,7 +136,7 @@ public class TestUUIDPairwiseIdentiferService {
public void testGetIdentifier_newEqual() { public void testGetIdentifier_newEqual() {
String pairwise1 = service.getIdentifier(userInfoRegular, pairwiseClient1); String pairwise1 = service.getIdentifier(userInfoRegular, pairwiseClient1);
Mockito.verify(pairwiseIdentifierRepository, Mockito.atLeast(1)).save(Mockito.any(PairwiseIdentifier.class)); Mockito.verify(pairwiseIdentifierRepository, Mockito.atLeast(1)).save(Matchers.any(PairwiseIdentifier.class));
PairwiseIdentifier pairwiseId = new PairwiseIdentifier(); PairwiseIdentifier pairwiseId = new PairwiseIdentifier();
pairwiseId.setUserSub(regularSub); pairwiseId.setUserSub(regularSub);