Merge branch 'master' into uma-introspection
* master: fixed logger variable name made logger declarations consistent across project, closes #780 Fixed logger null safe removed DateUtil added icons to scope editing panelpull/708/merge
commit
ee522100b9
|
@ -84,7 +84,10 @@ public class IntrospectingTokenService implements ResourceServerTokenServices {
|
|||
}
|
||||
|
||||
private Map<String, TokenCacheObject> authCache = new HashMap<String, TokenCacheObject>();
|
||||
private static Logger logger = LoggerFactory.getLogger(IntrospectingTokenService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(IntrospectingTokenService.class);
|
||||
|
||||
/**
|
||||
* @return the introspectionConfigurationService
|
||||
|
|
|
@ -47,7 +47,10 @@ import com.google.gson.JsonParser;
|
|||
*/
|
||||
public class UserInfoFetcher {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(UserInfoFetcher.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(UserInfoFetcher.class);
|
||||
|
||||
public UserInfo loadUserInfo(final OIDCAuthenticationToken token) {
|
||||
|
||||
|
|
|
@ -55,7 +55,10 @@ import com.google.gson.JsonObject;
|
|||
*/
|
||||
public class DynamicRegistrationClientConfigurationService implements ClientConfigurationService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DynamicServerConfigurationService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DynamicRegistrationClientConfigurationService.class);
|
||||
|
||||
private LoadingCache<ServerConfiguration, RegisteredClient> clients;
|
||||
|
||||
|
|
|
@ -57,7 +57,10 @@ import com.google.gson.JsonParser;
|
|||
*/
|
||||
public class DynamicServerConfigurationService implements ServerConfigurationService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DynamicServerConfigurationService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DynamicServerConfigurationService.class);
|
||||
|
||||
// map of issuer -> server configuration, loaded dynamically from service discovery
|
||||
private LoadingCache<String, ServerConfiguration> servers;
|
||||
|
|
|
@ -50,7 +50,10 @@ import com.google.gson.JsonSerializer;
|
|||
*/
|
||||
public class JsonFileRegisteredClientService implements RegisteredClientService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonFileRegisteredClientService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JsonFileRegisteredClientService.class);
|
||||
|
||||
private Gson gson = new GsonBuilder()
|
||||
.registerTypeAdapter(RegisteredClient.class, new JsonSerializer<RegisteredClient>() {
|
||||
|
|
|
@ -55,7 +55,10 @@ import com.google.gson.JsonParser;
|
|||
*/
|
||||
public class WebfingerIssuerService implements IssuerService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WebfingerIssuerService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebfingerIssuerService.class);
|
||||
|
||||
// map of user input -> issuer, loaded dynamically from webfinger discover
|
||||
private LoadingCache<UriComponents, String> issuers;
|
||||
|
|
|
@ -35,7 +35,10 @@ import com.google.common.base.Strings;
|
|||
*/
|
||||
public class WebfingerURLNormalizer {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WebfingerURLNormalizer.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebfingerURLNormalizer.class);
|
||||
|
||||
// pattern used to parse user input; we can't use the built-in java URI parser
|
||||
private static final Pattern pattern = Pattern.compile("^" +
|
||||
|
|
|
@ -52,7 +52,10 @@ import com.nimbusds.jose.jwk.RSAKey;
|
|||
*/
|
||||
public class DefaultJWTEncryptionAndDecryptionService implements JWTEncryptionAndDecryptionService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DefaultJWTEncryptionAndDecryptionService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultJWTEncryptionAndDecryptionService.class);
|
||||
|
||||
// map of identifier to encrypter
|
||||
private Map<String, JWEEncrypter> encrypters = new HashMap<String, JWEEncrypter>();
|
||||
|
|
|
@ -53,7 +53,10 @@ public class DefaultJWTSigningAndValidationService implements JWTSigningAndValid
|
|||
// map of identifier to verifier
|
||||
private Map<String, JWSVerifier> verifiers = new HashMap<String, JWSVerifier>();
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DefaultJWTSigningAndValidationService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultJWTSigningAndValidationService.class);
|
||||
|
||||
private String defaultSignerKeyId;
|
||||
|
||||
|
|
|
@ -51,7 +51,10 @@ import com.nimbusds.jose.jwk.JWKSet;
|
|||
@Service
|
||||
public class JWKSetCacheService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JWKSetCacheService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JWKSetCacheService.class);
|
||||
|
||||
// map of jwk set uri -> signing/validation service built on the keys found in that jwk set
|
||||
private LoadingCache<String, JWTSigningAndValidationService> validators;
|
||||
|
|
|
@ -48,7 +48,10 @@ import com.nimbusds.jose.util.Base64URL;
|
|||
@Service
|
||||
public class SymmetricKeyJWTValidatorCacheService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(SymmetricKeyJWTValidatorCacheService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(SymmetricKeyJWTValidatorCacheService.class);
|
||||
|
||||
private LoadingCache<String, JWTSigningAndValidationService> validators;
|
||||
|
||||
|
|
|
@ -37,7 +37,10 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public class ConfigurationPropertiesBean {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ConfigurationPropertiesBean.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConfigurationPropertiesBean.class);
|
||||
|
||||
private String issuer;
|
||||
|
||||
|
|
|
@ -43,7 +43,10 @@ import com.nimbusds.jose.jwk.JWKSet;
|
|||
public class JWKSetView extends AbstractView {
|
||||
|
||||
public static final String VIEWNAME = "jwkSet";
|
||||
private static Logger logger = LoggerFactory.getLogger(JWKSetView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JWKSetView.class);
|
||||
|
||||
@Override
|
||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
|
|
@ -59,8 +59,11 @@ import com.nimbusds.jose.JWSAlgorithm;
|
|||
@SuppressWarnings(value = {"rawtypes", "unchecked"})
|
||||
public class JsonUtils {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonUtils.class);
|
||||
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JsonUtils.class);
|
||||
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
/**
|
||||
|
|
|
@ -136,6 +136,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" id="defaultScope">
|
||||
<label class="control-label"><span class="label label-success default"><i class="icon-flag icon-white"></i></span></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" <%-defaultScope ? 'checked' : '' %>> <span data-i18n="scope.system-scope-form.default">default scope</span>
|
||||
|
@ -145,6 +146,7 @@
|
|||
</div>
|
||||
|
||||
<div class="control-group" id="restricted">
|
||||
<label class="control-label"><span class="label label-warning restricted"><i class="icon-ban-circle icon-white"></i></span></label>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" <%-restricted ? 'checked' : '' %>> <span data-i18n="scope.system-scope-form.restricted">restricted</span>
|
||||
|
|
|
@ -47,7 +47,10 @@ import com.google.gson.JsonObject;
|
|||
@Component("webfingerView")
|
||||
public class WebfingerView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WebfingerView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebfingerView.class);
|
||||
|
||||
private Gson gson = new GsonBuilder()
|
||||
.setExclusionStrategies(new ExclusionStrategy() {
|
||||
|
|
|
@ -61,7 +61,10 @@ import com.nimbusds.jose.JWSAlgorithm;
|
|||
@Controller
|
||||
public class DiscoveryEndpoint {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DiscoveryEndpoint.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DiscoveryEndpoint.class);
|
||||
|
||||
@Autowired
|
||||
private ConfigurationPropertiesBean config;
|
||||
|
|
|
@ -41,7 +41,10 @@ import com.google.common.collect.Sets;
|
|||
@Service
|
||||
public class DefaultIntrospectionResultAssembler implements IntrospectionResultAssembler {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(DefaultIntrospectionResultAssembler.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultIntrospectionResultAssembler.class);
|
||||
|
||||
@Override
|
||||
public Map<String, Object> assembleFrom(OAuth2AccessTokenEntity accessToken, UserInfo userInfo, Set<String> authScopes) {
|
||||
|
@ -60,7 +63,7 @@ public class DefaultIntrospectionResultAssembler implements IntrospectionResultA
|
|||
result.put(EXPIRES_AT, dateFormat.valueToString(accessToken.getExpiration()));
|
||||
result.put(EXP, accessToken.getExpiration().getTime() / 1000L);
|
||||
} catch (ParseException e) {
|
||||
log.error("Parse exception in token introspection", e);
|
||||
logger.error("Parse exception in token introspection", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +101,7 @@ public class DefaultIntrospectionResultAssembler implements IntrospectionResultA
|
|||
result.put(EXPIRES_AT, dateFormat.valueToString(refreshToken.getExpiration()));
|
||||
result.put(EXP, refreshToken.getExpiration().getTime() / 1000L);
|
||||
} catch (ParseException e) {
|
||||
log.error("Parse exception in token introspection", e);
|
||||
logger.error("Parse exception in token introspection", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,10 @@ import com.google.gson.JsonParser;
|
|||
@Service
|
||||
public class DefaultOAuth2ClientDetailsEntityService implements ClientDetailsEntityService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DefaultOAuth2ClientDetailsEntityService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultOAuth2ClientDetailsEntityService.class);
|
||||
|
||||
@Autowired
|
||||
private OAuth2ClientRepository clientRepository;
|
||||
|
|
|
@ -64,7 +64,10 @@ import com.nimbusds.jwt.PlainJWT;
|
|||
@Service("defaultOAuth2ProviderTokenService")
|
||||
public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DefaultOAuth2ProviderTokenService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultOAuth2ProviderTokenService.class);
|
||||
|
||||
@Autowired
|
||||
private OAuth2TokenRepository tokenRepository;
|
||||
|
|
|
@ -48,7 +48,10 @@ public class TokenApiView extends AbstractView {
|
|||
|
||||
public static final String VIEWNAME = "tokenApiView";
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonEntityView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(TokenApiView.class);
|
||||
|
||||
private Gson gson = new GsonBuilder()
|
||||
.setExclusionStrategies(new ExclusionStrategy() {
|
||||
|
|
|
@ -69,7 +69,10 @@ public class IntrospectionEndpoint {
|
|||
@Autowired
|
||||
private ResourceSetService resourceSetService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(IntrospectionEndpoint.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(IntrospectionEndpoint.class);
|
||||
|
||||
public IntrospectionEndpoint() {
|
||||
|
||||
|
|
|
@ -80,7 +80,10 @@ public class OAuthConfirmationController {
|
|||
@Autowired
|
||||
private StatsService statsService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(OAuthConfirmationController.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(OAuthConfirmationController.class);
|
||||
|
||||
public OAuthConfirmationController() {
|
||||
|
||||
|
|
|
@ -40,7 +40,10 @@ public class RevocationEndpoint {
|
|||
@Autowired
|
||||
OAuth2TokenEntityService tokenServices;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(RevocationEndpoint.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(RevocationEndpoint.class);
|
||||
|
||||
@PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_CLIENT')")
|
||||
@RequestMapping("/revoke")
|
||||
|
|
|
@ -52,7 +52,10 @@ public class ScopeAPI {
|
|||
@Autowired
|
||||
private SystemScopeService scopeService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ScopeAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ScopeAPI.class);
|
||||
|
||||
private Gson gson = new Gson();
|
||||
|
||||
|
|
|
@ -59,7 +59,10 @@ public class TokenAPI {
|
|||
@Autowired
|
||||
private OIDCTokenService oidcTokenService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(TokenAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(TokenAPI.class);
|
||||
|
||||
@RequestMapping(value = "/access", method = RequestMethod.GET, produces = "application/json")
|
||||
public String getAllAccessTokens(ModelMap m, Principal p) {
|
||||
|
|
|
@ -54,6 +54,9 @@ import com.nimbusds.jwt.SignedJWT;
|
|||
*/
|
||||
public class JWTBearerAuthenticationProvider implements AuthenticationProvider {
|
||||
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JWTBearerAuthenticationProvider.class);
|
||||
|
||||
private static final GrantedAuthority ROLE_CLIENT = new SimpleGrantedAuthority("ROLE_CLIENT");
|
||||
|
|
|
@ -59,8 +59,10 @@ import com.google.common.base.Strings;
|
|||
@Component("authRequestFilter")
|
||||
public class AuthorizationRequestFilter extends GenericFilterBean {
|
||||
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(AuthorizationRequestFilter.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(AuthorizationRequestFilter.class);
|
||||
|
||||
public final static String PROMPTED = "PROMPT_FILTER_PROMPTED";
|
||||
public final static String PROMPT_REQUESTED = "PROMPT_FILTER_REQUESTED";
|
||||
|
|
|
@ -58,7 +58,10 @@ import com.nimbusds.jwt.SignedJWT;
|
|||
@Component("connectOAuth2RequestFactory")
|
||||
public class ConnectOAuth2RequestFactory extends DefaultOAuth2RequestFactory {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ConnectOAuth2RequestFactory.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConnectOAuth2RequestFactory.class);
|
||||
|
||||
private ClientDetailsEntityService clientDetailsService;
|
||||
|
||||
|
|
|
@ -46,7 +46,10 @@ import com.google.common.collect.Collections2;
|
|||
@Service("defaultApprovedSiteService")
|
||||
public class DefaultApprovedSiteService implements ApprovedSiteService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DefaultApprovedSiteService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultApprovedSiteService.class);
|
||||
|
||||
@Autowired
|
||||
private ApprovedSiteRepository approvedSiteRepository;
|
||||
|
|
|
@ -68,7 +68,10 @@ import com.nimbusds.jwt.SignedJWT;
|
|||
@Service
|
||||
public class DefaultOIDCTokenService implements OIDCTokenService {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(DefaultOIDCTokenService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DefaultOIDCTokenService.class);
|
||||
|
||||
@Autowired
|
||||
private JWTSigningAndValidationService jwtService;
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.mitre.openid.connect.service.impl;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
|
||||
public abstract class MITREidDataServiceSupport {
|
||||
private final DateFormatter dateFormatter;
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(MITREidDataServiceSupport.class);
|
||||
|
||||
public MITREidDataServiceSupport() {
|
||||
dateFormatter = new DateFormatter();
|
||||
dateFormatter.setIso(ISO.DATE_TIME);
|
||||
}
|
||||
|
||||
protected Date utcToDate(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return dateFormatter.parse(value, Locale.ENGLISH);
|
||||
} catch (ParseException ex) {
|
||||
logger.error("Unable to parse datetime {}", value, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String toUTCString(Date value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return dateFormatter.print(value, Locale.ENGLISH);
|
||||
}
|
||||
|
||||
}
|
|
@ -52,7 +52,6 @@ import org.mitre.openid.connect.repository.ApprovedSiteRepository;
|
|||
import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
|
||||
import org.mitre.openid.connect.repository.WhitelistedSiteRepository;
|
||||
import org.mitre.openid.connect.service.MITREidDataService;
|
||||
import org.mitre.openid.connect.util.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -76,9 +75,12 @@ import com.google.gson.stream.JsonWriter;
|
|||
*/
|
||||
@Service
|
||||
@SuppressWarnings(value = {"unchecked"})
|
||||
public class MITREidDataService_1_0 implements MITREidDataService {
|
||||
public class MITREidDataService_1_0 extends MITREidDataServiceSupport implements MITREidDataService {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(MITREidDataService_1_0.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(MITREidDataService_1_0.class);
|
||||
@Autowired
|
||||
private OAuth2ClientRepository clientRepository;
|
||||
@Autowired
|
||||
|
@ -93,6 +95,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
|||
private OAuth2TokenRepository tokenRepository;
|
||||
@Autowired
|
||||
private SystemScopeRepository sysScopeRepository;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mitre.openid.connect.service.MITREidDataService#export(com.google.gson.stream.JsonWriter)
|
||||
*/
|
||||
|
@ -151,7 +154,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
|||
private Map<Long, String> refreshTokenToClientRefs = new HashMap<Long, String>();
|
||||
private Map<Long, Long> refreshTokenToAuthHolderRefs = new HashMap<Long, Long>();
|
||||
private Map<Long, Long> refreshTokenOldToNewIdMap = new HashMap<Long, Long>();
|
||||
|
||||
|
||||
/**
|
||||
* @param reader
|
||||
* @throws IOException
|
||||
|
@ -179,7 +182,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("expiration")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
token.setExpiration(date);
|
||||
} else if (name.equals("value")) {
|
||||
String value = reader.nextString();
|
||||
|
@ -248,7 +251,7 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("expiration")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
token.setExpiration(date);
|
||||
} else if (name.equals("value")) {
|
||||
String value = reader.nextString();
|
||||
|
@ -461,15 +464,15 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("accessDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setAccessDate(date);
|
||||
} else if (name.equals("clientId")) {
|
||||
site.setClientId(reader.nextString());
|
||||
} else if (name.equals("creationDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setCreationDate(date);
|
||||
} else if (name.equals("timeoutDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setTimeoutDate(date);
|
||||
} else if (name.equals("userId")) {
|
||||
site.setUserId(reader.nextString());
|
||||
|
@ -848,4 +851,5 @@ public class MITREidDataService_1_0 implements MITREidDataService {
|
|||
accessTokenOldToNewIdMap.clear();
|
||||
grantOldToNewIdMap.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.mitre.openid.connect.repository.ApprovedSiteRepository;
|
|||
import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
|
||||
import org.mitre.openid.connect.repository.WhitelistedSiteRepository;
|
||||
import org.mitre.openid.connect.service.MITREidDataService;
|
||||
import org.mitre.openid.connect.util.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -79,9 +78,12 @@ import com.google.gson.stream.JsonWriter;
|
|||
*/
|
||||
@Service
|
||||
@SuppressWarnings(value = {"unchecked"})
|
||||
public class MITREidDataService_1_1 implements MITREidDataService {
|
||||
public class MITREidDataService_1_1 extends MITREidDataServiceSupport implements MITREidDataService {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(MITREidDataService_1_1.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(MITREidDataService_1_1.class);
|
||||
@Autowired
|
||||
private OAuth2ClientRepository clientRepository;
|
||||
@Autowired
|
||||
|
@ -96,8 +98,7 @@ public class MITREidDataService_1_1 implements MITREidDataService {
|
|||
private OAuth2TokenRepository tokenRepository;
|
||||
@Autowired
|
||||
private SystemScopeRepository sysScopeRepository;
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mitre.openid.connect.service.MITREidDataService#export(com.google.gson.stream.JsonWriter)
|
||||
*/
|
||||
|
@ -183,7 +184,7 @@ public class MITREidDataService_1_1 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("expiration")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
token.setExpiration(date);
|
||||
} else if (name.equals("value")) {
|
||||
String value = reader.nextString();
|
||||
|
@ -252,7 +253,7 @@ public class MITREidDataService_1_1 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("expiration")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
token.setExpiration(date);
|
||||
} else if (name.equals("value")) {
|
||||
String value = reader.nextString();
|
||||
|
@ -471,15 +472,15 @@ public class MITREidDataService_1_1 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("accessDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setAccessDate(date);
|
||||
} else if (name.equals("clientId")) {
|
||||
site.setClientId(reader.nextString());
|
||||
} else if (name.equals("creationDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setCreationDate(date);
|
||||
} else if (name.equals("timeoutDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setTimeoutDate(date);
|
||||
} else if (name.equals("userId")) {
|
||||
site.setUserId(reader.nextString());
|
||||
|
@ -861,4 +862,5 @@ public class MITREidDataService_1_1 implements MITREidDataService {
|
|||
accessTokenOldToNewIdMap.clear();
|
||||
grantOldToNewIdMap.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,7 +56,6 @@ import org.mitre.openid.connect.repository.ApprovedSiteRepository;
|
|||
import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
|
||||
import org.mitre.openid.connect.repository.WhitelistedSiteRepository;
|
||||
import org.mitre.openid.connect.service.MITREidDataService;
|
||||
import org.mitre.openid.connect.util.DateUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -81,9 +80,12 @@ import com.google.gson.stream.JsonWriter;
|
|||
*/
|
||||
@Service
|
||||
@SuppressWarnings(value = {"unchecked"})
|
||||
public class MITREidDataService_1_2 implements MITREidDataService {
|
||||
public class MITREidDataService_1_2 extends MITREidDataServiceSupport implements MITREidDataService {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(MITREidDataService_1_2.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(MITREidDataService_1_2.class);
|
||||
@Autowired
|
||||
private OAuth2ClientRepository clientRepository;
|
||||
@Autowired
|
||||
|
@ -98,8 +100,7 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
private OAuth2TokenRepository tokenRepository;
|
||||
@Autowired
|
||||
private SystemScopeRepository sysScopeRepository;
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.mitre.openid.connect.service.MITREidDataService#export(com.google.gson.stream.JsonWriter)
|
||||
*/
|
||||
|
@ -162,7 +163,7 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
for (OAuth2RefreshTokenEntity token : tokenRepository.getAllRefreshTokens()) {
|
||||
writer.beginObject();
|
||||
writer.name("id").value(token.getId());
|
||||
writer.name("expiration").value(DateUtil.toUTCString(token.getExpiration()));
|
||||
writer.name("expiration").value(toUTCString(token.getExpiration()));
|
||||
writer.name("clientId")
|
||||
.value((token.getClient() != null) ? token.getClient().getClientId() : null);
|
||||
writer.name("authenticationHolderId")
|
||||
|
@ -181,7 +182,7 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
for (OAuth2AccessTokenEntity token : tokenRepository.getAllAccessTokens()) {
|
||||
writer.beginObject();
|
||||
writer.name("id").value(token.getId());
|
||||
writer.name("expiration").value(DateUtil.toUTCString(token.getExpiration()));
|
||||
writer.name("expiration").value(toUTCString(token.getExpiration()));
|
||||
writer.name("clientId")
|
||||
.value((token.getClient() != null) ? token.getClient().getClientId() : null);
|
||||
writer.name("authenticationHolderId")
|
||||
|
@ -280,10 +281,10 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
for (ApprovedSite site : approvedSiteRepository.getAll()) {
|
||||
writer.beginObject();
|
||||
writer.name("id").value(site.getId());
|
||||
writer.name("accessDate").value(DateUtil.toUTCString(site.getAccessDate()));
|
||||
writer.name("accessDate").value(toUTCString(site.getAccessDate()));
|
||||
writer.name("clientId").value(site.getClientId());
|
||||
writer.name("creationDate").value(DateUtil.toUTCString(site.getCreationDate()));
|
||||
writer.name("timeoutDate").value(DateUtil.toUTCString(site.getTimeoutDate()));
|
||||
writer.name("creationDate").value(toUTCString(site.getCreationDate()));
|
||||
writer.name("timeoutDate").value(toUTCString(site.getTimeoutDate()));
|
||||
writer.name("userId").value(site.getUserId());
|
||||
writer.name("allowedScopes");
|
||||
writeNullSafeArray(writer, site.getAllowedScopes());
|
||||
|
@ -523,7 +524,7 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("expiration")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
token.setExpiration(date);
|
||||
} else if (name.equals("value")) {
|
||||
String value = reader.nextString();
|
||||
|
@ -592,7 +593,7 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("expiration")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
token.setExpiration(date);
|
||||
} else if (name.equals("value")) {
|
||||
String value = reader.nextString();
|
||||
|
@ -811,15 +812,15 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
} else if (name.equals("id")) {
|
||||
currentId = reader.nextLong();
|
||||
} else if (name.equals("accessDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setAccessDate(date);
|
||||
} else if (name.equals("clientId")) {
|
||||
site.setClientId(reader.nextString());
|
||||
} else if (name.equals("creationDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setCreationDate(date);
|
||||
} else if (name.equals("timeoutDate")) {
|
||||
Date date = DateUtil.utcToDate(reader.nextString());
|
||||
Date date = utcToDate(reader.nextString());
|
||||
site.setTimeoutDate(date);
|
||||
} else if (name.equals("userId")) {
|
||||
site.setUserId(reader.nextString());
|
||||
|
@ -1200,4 +1201,5 @@ public class MITREidDataService_1_2 implements MITREidDataService {
|
|||
accessTokenOldToNewIdMap.clear();
|
||||
grantOldToNewIdMap.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,10 @@ import com.google.common.collect.Iterables;
|
|||
@Service("uuidPairwiseIdentiferService")
|
||||
public class UUIDPairwiseIdentiferService implements PairwiseIdentiferService {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(UUIDPairwiseIdentiferService.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(UUIDPairwiseIdentiferService.class);
|
||||
|
||||
@Autowired
|
||||
private PairwiseIdentifierRepository pairwiseIdentifierRepository;
|
||||
|
|
|
@ -49,7 +49,10 @@ import com.nimbusds.jwt.SignedJWT;
|
|||
@Service
|
||||
public class ConnectTokenEnhancer implements TokenEnhancer {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(ConnectTokenEnhancer.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConnectTokenEnhancer.class);
|
||||
|
||||
@Autowired
|
||||
private ConfigurationPropertiesBean configBean;
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright 2015 The MITRE Corporation
|
||||
* and the MIT Kerberos and Internet Trust Consortium
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
package org.mitre.openid.connect.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author arielak
|
||||
*/
|
||||
public class DateUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(DateUtil.class);
|
||||
private static final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||
private static final SimpleDateFormat sdf = new SimpleDateFormat(ISO_FORMAT);
|
||||
private static final TimeZone utc = TimeZone.getTimeZone("UTC");
|
||||
|
||||
public static String toUTCString(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
sdf.setTimeZone(utc);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static Date utcToDate(String s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
Date d = null;
|
||||
try {
|
||||
d = sdf.parse(s);
|
||||
} catch(ParseException ex) {
|
||||
log.error("Unable to parse date string {}", s, ex);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
}
|
|
@ -37,7 +37,10 @@ import com.nimbusds.jose.util.Base64URL;
|
|||
*/
|
||||
public class IdTokenHashUtils {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(IdTokenHashUtils.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(IdTokenHashUtils.class);
|
||||
|
||||
/**
|
||||
* Compute the SHA hash of an authorization code
|
||||
|
|
|
@ -54,7 +54,10 @@ import com.google.gson.JsonSerializer;
|
|||
*
|
||||
*/
|
||||
public abstract class AbstractClientEntityView extends AbstractView {
|
||||
private static Logger logger = LoggerFactory.getLogger(ClientEntityViewForAdmins.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbstractClientEntityView.class);
|
||||
|
||||
private Gson gson = new GsonBuilder()
|
||||
.setExclusionStrategies(getExclusionStrategy())
|
||||
|
|
|
@ -49,7 +49,10 @@ import com.google.gson.JsonObject;
|
|||
@Component(ClientInformationResponseView.VIEWNAME)
|
||||
public class ClientInformationResponseView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ClientInformationResponseView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ClientInformationResponseView.class);
|
||||
|
||||
public static final String VIEWNAME = "clientInformationResponseView";
|
||||
|
||||
|
|
|
@ -52,7 +52,10 @@ import com.google.gson.JsonSerializer;
|
|||
@Component(JsonApprovedSiteView.VIEWNAME)
|
||||
public class JsonApprovedSiteView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonApprovedSiteView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JsonApprovedSiteView.class);
|
||||
|
||||
public static final String VIEWNAME = "jsonApprovedSiteView";
|
||||
|
||||
|
|
|
@ -45,7 +45,10 @@ import com.google.gson.GsonBuilder;
|
|||
@Component(JsonEntityView.VIEWNAME)
|
||||
public class JsonEntityView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonEntityView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JsonEntityView.class);
|
||||
|
||||
public static final String VIEWNAME = "jsonEntityView";
|
||||
|
||||
|
|
|
@ -44,7 +44,10 @@ import com.google.gson.JsonObject;
|
|||
@Component(JsonErrorView.VIEWNAME)
|
||||
public class JsonErrorView extends AbstractView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(JsonEntityView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(JsonErrorView.class);
|
||||
|
||||
public static final String VIEWNAME = "jsonErrorView";
|
||||
|
||||
|
|
|
@ -59,7 +59,10 @@ import com.nimbusds.jwt.SignedJWT;
|
|||
@Component(UserInfoJWTView.VIEWNAME)
|
||||
public class UserInfoJWTView extends UserInfoView {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(UserInfoJWTView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(UserInfoJWTView.class);
|
||||
|
||||
public static final String VIEWNAME = "userInfoJwtView";
|
||||
|
||||
|
|
|
@ -50,7 +50,10 @@ public class UserInfoView extends AbstractView {
|
|||
|
||||
public static final String VIEWNAME = "userInfoView";
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(UserInfoView.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(UserInfoView.class);
|
||||
|
||||
@Autowired
|
||||
private ScopeClaimTranslationService translator;
|
||||
|
|
|
@ -54,7 +54,10 @@ public class ApprovedSiteAPI {
|
|||
@Autowired
|
||||
OAuth2TokenEntityService tokenServices;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ApprovedSiteAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ApprovedSiteAPI.class);
|
||||
|
||||
/**
|
||||
* Get a list of all of this user's approved sites
|
||||
|
|
|
@ -44,7 +44,10 @@ import org.springframework.stereotype.Component;
|
|||
@Component("authenticationTimeStamper")
|
||||
public class AuthenticationTimeStamper extends SavedRequestAwareAuthenticationSuccessHandler {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(AuthenticationTimeStamper.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(AuthenticationTimeStamper.class);
|
||||
|
||||
public static final String AUTH_TIMESTAMP = "AUTH_TIMESTAMP";
|
||||
|
||||
|
|
|
@ -56,7 +56,10 @@ public class BlacklistAPI {
|
|||
@Autowired
|
||||
private BlacklistedSiteService blacklistService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(BlacklistAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(BlacklistAPI.class);
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private JsonParser parser = new JsonParser();
|
||||
|
|
|
@ -108,7 +108,10 @@ public class ClientAPI {
|
|||
.setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
.create();
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ClientAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ClientAPI.class);
|
||||
|
||||
/**
|
||||
* Get a list of all clients
|
||||
|
|
|
@ -53,7 +53,10 @@ import com.google.gson.stream.JsonWriter;
|
|||
@PreAuthorize("hasRole('ROLE_ADMIN')") // you need to be an admin to even think about this -- this is a potentially dangerous API!!
|
||||
public class DataAPI {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DataAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataAPI.class);
|
||||
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
|
||||
|
|
|
@ -85,7 +85,10 @@ public class DynamicClientRegistrationEndpoint {
|
|||
@Autowired
|
||||
private OIDCTokenService connectTokenService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(DynamicClientRegistrationEndpoint.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(DynamicClientRegistrationEndpoint.class);
|
||||
|
||||
/**
|
||||
* Create a new Client, issue a client ID, and create a registration access token.
|
||||
|
|
|
@ -82,7 +82,10 @@ public class ProtectedResourceRegistrationEndpoint {
|
|||
@Autowired
|
||||
private OIDCTokenService connectTokenService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ProtectedResourceRegistrationEndpoint.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(ProtectedResourceRegistrationEndpoint.class);
|
||||
|
||||
/**
|
||||
* Create a new Client, issue a client ID, and create a registration access token.
|
||||
|
|
|
@ -56,7 +56,10 @@ public class UserInfoEndpoint {
|
|||
@Autowired
|
||||
private ClientDetailsEntityService clientService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(UserInfoEndpoint.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(UserInfoEndpoint.class);
|
||||
|
||||
private static final MediaType JOSE_MEDIA_TYPE = new MediaType("application", "jwt");
|
||||
|
||||
|
|
|
@ -56,7 +56,10 @@ public class WhitelistAPI {
|
|||
@Autowired
|
||||
private WhitelistedSiteService whitelistService;
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(WhitelistAPI.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = LoggerFactory.getLogger(WhitelistAPI.class);
|
||||
|
||||
private Gson gson = new Gson();
|
||||
private JsonParser parser = new JsonParser();
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -61,7 +62,6 @@ import org.mitre.openid.connect.repository.ApprovedSiteRepository;
|
|||
import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
|
||||
import org.mitre.openid.connect.repository.WhitelistedSiteRepository;
|
||||
import org.mitre.openid.connect.service.MITREidDataService;
|
||||
import org.mitre.openid.connect.util.DateUtil;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.InjectMocks;
|
||||
|
@ -70,6 +70,8 @@ import org.mockito.Mockito;
|
|||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
|
@ -117,9 +119,13 @@ public class TestMITREidDataService_1_0 {
|
|||
|
||||
@InjectMocks
|
||||
private MITREidDataService_1_0 dataService;
|
||||
|
||||
private DateFormatter formatter;
|
||||
|
||||
@Before
|
||||
public void prepare() {
|
||||
formatter = new DateFormatter();
|
||||
formatter.setIso(ISO.DATE_TIME);
|
||||
Mockito.reset(clientRepository, approvedSiteRepository, authHolderRepository, tokenRepository, sysScopeRepository, wlSiteRepository, blSiteRepository);
|
||||
}
|
||||
|
||||
|
@ -129,11 +135,10 @@ public class TestMITREidDataService_1_0 {
|
|||
return entity1.getId().compareTo(entity2.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse("2014-09-10T22:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -148,8 +153,7 @@ public class TestMITREidDataService_1_0 {
|
|||
token1.setValue("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.");
|
||||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse("2015-01-07T18:31:50.079+0000", Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -251,8 +255,7 @@ public class TestMITREidDataService_1_0 {
|
|||
|
||||
@Test
|
||||
public void testImportAccessTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse("2014-09-10T22:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -270,7 +273,7 @@ public class TestMITREidDataService_1_0 {
|
|||
token1.setTokenType("Bearer");
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -567,9 +570,9 @@ public class TestMITREidDataService_1_0 {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testImportGrants() throws IOException {
|
||||
Date creationDate1 = DateUtil.utcToDate("2014-09-10T22:49:44.090+0000");
|
||||
Date accessDate1 = DateUtil.utcToDate("2014-09-10T23:49:44.090+0000");
|
||||
public void testImportGrants() throws IOException, ParseException {
|
||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
WhitelistedSite mockWlSite1 = mock(WhitelistedSite.class);
|
||||
when(mockWlSite1.getId()).thenReturn(1L);
|
||||
|
@ -587,9 +590,9 @@ public class TestMITREidDataService_1_0 {
|
|||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||
site1.setApprovedAccessTokens(ImmutableSet.of(mockToken1));
|
||||
|
||||
Date creationDate2 = DateUtil.utcToDate("2014-09-11T18:49:44.090+0000");
|
||||
Date accessDate2 = DateUtil.utcToDate("2014-09-11T20:49:44.090+0000");
|
||||
Date timeoutDate2 = DateUtil.utcToDate("2014-10-01T20:49:44.090+0000");
|
||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+0000", Locale.ENGLISH);
|
||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
ApprovedSite site2 = new ApprovedSite();
|
||||
site2.setId(2L);
|
||||
|
@ -831,7 +834,7 @@ public class TestMITREidDataService_1_0 {
|
|||
@Test
|
||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -854,7 +857,7 @@ public class TestMITREidDataService_1_0 {
|
|||
token1.setAuthenticationHolder(holder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
|
|
@ -40,6 +40,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
|
@ -61,7 +62,6 @@ import org.mitre.openid.connect.repository.ApprovedSiteRepository;
|
|||
import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
|
||||
import org.mitre.openid.connect.repository.WhitelistedSiteRepository;
|
||||
import org.mitre.openid.connect.service.MITREidDataService;
|
||||
import org.mitre.openid.connect.util.DateUtil;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.InjectMocks;
|
||||
|
@ -70,6 +70,8 @@ import org.mockito.Mockito;
|
|||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
|
@ -117,9 +119,13 @@ public class TestMITREidDataService_1_1 {
|
|||
|
||||
@InjectMocks
|
||||
private MITREidDataService_1_1 dataService;
|
||||
private DateFormatter formatter;
|
||||
|
||||
@Before
|
||||
public void prepare() {
|
||||
formatter = new DateFormatter();
|
||||
formatter.setIso(ISO.DATE_TIME);
|
||||
|
||||
Mockito.reset(clientRepository, approvedSiteRepository, authHolderRepository, tokenRepository, sysScopeRepository, wlSiteRepository, blSiteRepository);
|
||||
}
|
||||
|
||||
|
@ -135,7 +141,7 @@ public class TestMITREidDataService_1_1 {
|
|||
@Test
|
||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -151,7 +157,7 @@ public class TestMITREidDataService_1_1 {
|
|||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -254,7 +260,7 @@ public class TestMITREidDataService_1_1 {
|
|||
@Test
|
||||
public void testImportAccessTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -272,7 +278,7 @@ public class TestMITREidDataService_1_1 {
|
|||
token1.setTokenType("Bearer");
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -568,9 +574,9 @@ public class TestMITREidDataService_1_1 {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testImportGrants() throws IOException {
|
||||
Date creationDate1 = DateUtil.utcToDate("2014-09-10T22:49:44.090+0000");
|
||||
Date accessDate1 = DateUtil.utcToDate("2014-09-10T23:49:44.090+0000");
|
||||
public void testImportGrants() throws IOException, ParseException {
|
||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
WhitelistedSite mockWlSite1 = mock(WhitelistedSite.class);
|
||||
when(mockWlSite1.getId()).thenReturn(1L);
|
||||
|
@ -588,9 +594,9 @@ public class TestMITREidDataService_1_1 {
|
|||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||
site1.setApprovedAccessTokens(ImmutableSet.of(mockToken1));
|
||||
|
||||
Date creationDate2 = DateUtil.utcToDate("2014-09-11T18:49:44.090+0000");
|
||||
Date accessDate2 = DateUtil.utcToDate("2014-09-11T20:49:44.090+0000");
|
||||
Date timeoutDate2 = DateUtil.utcToDate("2014-10-01T20:49:44.090+0000");
|
||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+0000", Locale.ENGLISH);
|
||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
ApprovedSite site2 = new ApprovedSite();
|
||||
site2.setId(2L);
|
||||
|
@ -840,7 +846,7 @@ public class TestMITREidDataService_1_1 {
|
|||
@Test
|
||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -863,7 +869,7 @@ public class TestMITREidDataService_1_1 {
|
|||
token1.setAuthenticationHolder(holder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
|
|
@ -44,6 +44,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -66,7 +67,6 @@ import org.mitre.openid.connect.repository.ApprovedSiteRepository;
|
|||
import org.mitre.openid.connect.repository.BlacklistedSiteRepository;
|
||||
import org.mitre.openid.connect.repository.WhitelistedSiteRepository;
|
||||
import org.mitre.openid.connect.service.MITREidDataService;
|
||||
import org.mitre.openid.connect.util.DateUtil;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Captor;
|
||||
import org.mockito.InjectMocks;
|
||||
|
@ -75,6 +75,8 @@ import org.mockito.Mockito;
|
|||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.format.annotation.DateTimeFormat.ISO;
|
||||
import org.springframework.format.datetime.DateFormatter;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
|
@ -127,16 +129,20 @@ public class TestMITREidDataService_1_2 {
|
|||
|
||||
@InjectMocks
|
||||
private MITREidDataService_1_2 dataService;
|
||||
private DateFormatter formatter;
|
||||
|
||||
@Before
|
||||
public void prepare() {
|
||||
formatter = new DateFormatter();
|
||||
formatter.setIso(ISO.DATE_TIME);
|
||||
|
||||
Mockito.reset(clientRepository, approvedSiteRepository, authHolderRepository, tokenRepository, sysScopeRepository, wlSiteRepository, blSiteRepository);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExportRefreshTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -152,7 +158,7 @@ public class TestMITREidDataService_1_2 {
|
|||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -238,7 +244,7 @@ public class TestMITREidDataService_1_2 {
|
|||
} else {
|
||||
assertThat(token.get("id").getAsLong(), equalTo(compare.getId()));
|
||||
assertThat(token.get("clientId").getAsString(), equalTo(compare.getClient().getClientId()));
|
||||
assertThat(token.get("expiration").getAsString(), equalTo(DateUtil.toUTCString(compare.getExpiration())));
|
||||
assertThat(token.get("expiration").getAsString(), equalTo(formatter.print(compare.getExpiration(), Locale.ENGLISH)));
|
||||
assertThat(token.get("value").getAsString(), equalTo(compare.getValue()));
|
||||
assertThat(token.get("authenticationHolderId").getAsLong(), equalTo(compare.getAuthenticationHolder().getId()));
|
||||
checked.add(compare);
|
||||
|
@ -259,7 +265,7 @@ public class TestMITREidDataService_1_2 {
|
|||
@Test
|
||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -275,7 +281,7 @@ public class TestMITREidDataService_1_2 {
|
|||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -371,7 +377,7 @@ public class TestMITREidDataService_1_2 {
|
|||
@Test
|
||||
public void testExportAccessTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -389,7 +395,7 @@ public class TestMITREidDataService_1_2 {
|
|||
token1.setTokenType("Bearer");
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -482,7 +488,7 @@ public class TestMITREidDataService_1_2 {
|
|||
} else {
|
||||
assertThat(token.get("id").getAsLong(), equalTo(compare.getId()));
|
||||
assertThat(token.get("clientId").getAsString(), equalTo(compare.getClient().getClientId()));
|
||||
assertThat(token.get("expiration").getAsString(), equalTo(DateUtil.toUTCString(compare.getExpiration())));
|
||||
assertThat(token.get("expiration").getAsString(), equalTo(formatter.print(compare.getExpiration(), Locale.ENGLISH)));
|
||||
assertThat(token.get("value").getAsString(), equalTo(compare.getValue()));
|
||||
assertThat(token.get("type").getAsString(), equalTo(compare.getTokenType()));
|
||||
assertThat(token.get("authenticationHolderId").getAsLong(), equalTo(compare.getAuthenticationHolder().getId()));
|
||||
|
@ -515,7 +521,7 @@ public class TestMITREidDataService_1_2 {
|
|||
@Test
|
||||
public void testImportAccessTokens() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -533,7 +539,7 @@ public class TestMITREidDataService_1_2 {
|
|||
token1.setTokenType("Bearer");
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
@ -1120,9 +1126,9 @@ public class TestMITREidDataService_1_2 {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testExportGrants() throws IOException {
|
||||
Date creationDate1 = DateUtil.utcToDate("2014-09-10T22:49:44.090+0000");
|
||||
Date accessDate1 = DateUtil.utcToDate("2014-09-10T23:49:44.090+0000");
|
||||
public void testExportGrants() throws IOException, ParseException {
|
||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
WhitelistedSite mockWlSite1 = mock(WhitelistedSite.class);
|
||||
when(mockWlSite1.getId()).thenReturn(1L);
|
||||
|
@ -1140,9 +1146,9 @@ public class TestMITREidDataService_1_2 {
|
|||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||
site1.setApprovedAccessTokens(ImmutableSet.of(mockToken1));
|
||||
|
||||
Date creationDate2 = DateUtil.utcToDate("2014-09-11T18:49:44.090+0000");
|
||||
Date accessDate2 = DateUtil.utcToDate("2014-09-11T20:49:44.090+0000");
|
||||
Date timeoutDate2 = DateUtil.utcToDate("2014-10-01T20:49:44.090+0000");
|
||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+0000", Locale.ENGLISH);
|
||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
ApprovedSite site2 = new ApprovedSite();
|
||||
site2.setId(2L);
|
||||
|
@ -1222,12 +1228,12 @@ public class TestMITREidDataService_1_2 {
|
|||
fail("Could not find matching whitelisted site id: " + site.get("id").getAsString());
|
||||
} else {
|
||||
assertThat(site.get("clientId").getAsString(), equalTo(compare.getClientId()));
|
||||
assertThat(site.get("creationDate").getAsString(), equalTo(DateUtil.toUTCString(compare.getCreationDate())));
|
||||
assertThat(site.get("accessDate").getAsString(), equalTo(DateUtil.toUTCString(compare.getAccessDate())));
|
||||
assertThat(site.get("creationDate").getAsString(), equalTo(formatter.print(compare.getCreationDate(), Locale.ENGLISH)));
|
||||
assertThat(site.get("accessDate").getAsString(), equalTo(formatter.print(compare.getAccessDate(), Locale.ENGLISH)));
|
||||
if(site.get("timeoutDate").isJsonNull()) {
|
||||
assertNull(compare.getTimeoutDate());
|
||||
} else {
|
||||
assertThat(site.get("timeoutDate").getAsString(), equalTo(DateUtil.toUTCString(compare.getTimeoutDate())));
|
||||
assertThat(site.get("timeoutDate").getAsString(), equalTo(formatter.print(compare.getTimeoutDate(), Locale.ENGLISH)));
|
||||
}
|
||||
assertThat(site.get("userId").getAsString(), equalTo(compare.getUserId()));
|
||||
assertThat(jsonArrayToStringSet(site.getAsJsonArray("allowedScopes")), equalTo(compare.getAllowedScopes()));
|
||||
|
@ -1254,9 +1260,9 @@ public class TestMITREidDataService_1_2 {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testImportGrants() throws IOException {
|
||||
Date creationDate1 = DateUtil.utcToDate("2014-09-10T22:49:44.090+0000");
|
||||
Date accessDate1 = DateUtil.utcToDate("2014-09-10T23:49:44.090+0000");
|
||||
public void testImportGrants() throws IOException, ParseException {
|
||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
WhitelistedSite mockWlSite1 = mock(WhitelistedSite.class);
|
||||
when(mockWlSite1.getId()).thenReturn(1L);
|
||||
|
@ -1274,9 +1280,9 @@ public class TestMITREidDataService_1_2 {
|
|||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||
site1.setApprovedAccessTokens(ImmutableSet.of(mockToken1));
|
||||
|
||||
Date creationDate2 = DateUtil.utcToDate("2014-09-11T18:49:44.090+0000");
|
||||
Date accessDate2 = DateUtil.utcToDate("2014-09-11T20:49:44.090+0000");
|
||||
Date timeoutDate2 = DateUtil.utcToDate("2014-10-01T20:49:44.090+0000");
|
||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+0000", Locale.ENGLISH);
|
||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+0000", Locale.ENGLISH);
|
||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+0000", Locale.ENGLISH);
|
||||
|
||||
ApprovedSite site2 = new ApprovedSite();
|
||||
site2.setId(2L);
|
||||
|
@ -1735,7 +1741,7 @@ public class TestMITREidDataService_1_2 {
|
|||
@Test
|
||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||
String expiration1 = "2014-09-10T22:49:44.090+0000";
|
||||
Date expirationDate1 = DateUtil.utcToDate(expiration1);
|
||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||
|
@ -1758,7 +1764,7 @@ public class TestMITREidDataService_1_2 {
|
|||
token1.setAuthenticationHolder(holder1);
|
||||
|
||||
String expiration2 = "2015-01-07T18:31:50.079+0000";
|
||||
Date expirationDate2 = DateUtil.utcToDate(expiration2);
|
||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||
|
||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||
|
|
Loading…
Reference in New Issue