Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Spring to 5.1.8.RELEASE and spring-security-oauth2 to 2.3.6.RELEASE #1496

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@

import java.util.Map;

import javax.annotation.PostConstruct;

import org.mitre.oauth2.model.RegisteredClient;
import org.mitre.openid.connect.client.service.ClientConfigurationService;
import org.mitre.openid.connect.config.ServerConfiguration;
import org.springframework.beans.factory.InitializingBean;

/**
* Client configuration service that holds a static map from issuer URL to a ClientDetails object to use at that issuer.
Expand All @@ -36,7 +35,7 @@
* @author jricher
*
*/
public class StaticClientConfigurationService implements ClientConfigurationService {
public class StaticClientConfigurationService implements ClientConfigurationService, InitializingBean {

// Map of issuer URL -> client configuration information
private Map<String, RegisteredClient> clients;
Expand Down Expand Up @@ -66,7 +65,7 @@ public RegisteredClient getClientConfiguration(ServerConfiguration issuer) {
return clients.get(issuer.getIssuer());
}

@PostConstruct
@Override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this change made? We moved to using PostConstruct many years ago, so I'm not sure why we'd move back.

public void afterPropertiesSet() {
if (clients == null || clients.isEmpty()) {
throw new IllegalArgumentException("Clients map cannot be null or empty");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@

import java.util.Map;

import javax.annotation.PostConstruct;

import org.mitre.openid.connect.client.service.ServerConfigurationService;
import org.mitre.openid.connect.config.ServerConfiguration;
import org.springframework.beans.factory.InitializingBean;

/**
* Statically configured server configuration service that maps issuer URLs to server configurations to use at that issuer.
*
* @author jricher
*
*/
public class StaticServerConfigurationService implements ServerConfigurationService {
public class StaticServerConfigurationService implements ServerConfigurationService, InitializingBean {

// map of issuer url -> server configuration information
private Map<String, ServerConfiguration> servers;
Expand All @@ -60,7 +60,7 @@ public ServerConfiguration getServerConfiguration(String issuer) {
return servers.get(issuer);
}

@PostConstruct
@Override
public void afterPropertiesSet() {
if (servers == null || servers.isEmpty()) {
throw new IllegalArgumentException("Servers map cannot be null or empty.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
*/
package org.mitre.openid.connect.client.service.impl;

import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;

import org.mitre.openid.connect.client.model.IssuerServiceResponse;
import org.mitre.openid.connect.client.service.IssuerService;

import com.google.common.base.Strings;
import org.springframework.beans.factory.InitializingBean;

/**
* @author jricher
*
*/
public class StaticSingleIssuerService implements IssuerService {
public class StaticSingleIssuerService implements IssuerService, InitializingBean {

private String issuer;

Expand Down Expand Up @@ -60,7 +60,7 @@ public IssuerServiceResponse getIssuer(HttpServletRequest request) {
return new IssuerServiceResponse(getIssuer(), null, null);
}

@PostConstruct
@Override
public void afterPropertiesSet() {

if (Strings.isNullOrEmpty(issuer)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import java.util.HashSet;
import java.util.Set;

import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;

import org.apache.http.client.utils.URIBuilder;
import org.mitre.openid.connect.client.model.IssuerServiceResponse;
import org.mitre.openid.connect.client.service.IssuerService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.AuthenticationServiceException;

import com.google.common.base.Strings;
Expand All @@ -41,7 +41,7 @@
* @author jricher
*
*/
public class ThirdPartyIssuerService implements IssuerService {
public class ThirdPartyIssuerService implements IssuerService, InitializingBean {

private String accountChooserUrl;

Expand Down Expand Up @@ -128,7 +128,7 @@ public void setBlacklist(Set<String> blacklist) {
this.blacklist = blacklist;
}

@PostConstruct
@Override
public void afterPropertiesSet() {
if (Strings.isNullOrEmpty(this.accountChooserUrl)) {
throw new IllegalArgumentException("Account Chooser URL cannot be null or empty");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import java.util.Map;
import java.util.Set;

import javax.annotation.PostConstruct;

import org.mitre.jose.keystore.JWKSetKeyStore;
import org.mitre.jwt.encryption.service.JWTEncryptionAndDecryptionService;
import org.slf4j.Logger;
Expand All @@ -50,12 +48,13 @@
import com.nimbusds.jose.jwk.JWK;
import com.nimbusds.jose.jwk.OctetSequenceKey;
import com.nimbusds.jose.jwk.RSAKey;
import org.springframework.beans.factory.InitializingBean;

/**
* @author wkim
*
*/
public class DefaultJWTEncryptionAndDecryptionService implements JWTEncryptionAndDecryptionService {
public class DefaultJWTEncryptionAndDecryptionService implements JWTEncryptionAndDecryptionService, InitializingBean {

/**
* Logger for this class
Expand Down Expand Up @@ -116,7 +115,7 @@ public DefaultJWTEncryptionAndDecryptionService(JWKSetKeyStore keyStore) throws
}


@PostConstruct
@Override
public void afterPropertiesSet() {

if (keys == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public UserDetails loadUserByUsername(String clientId) throws UsernameNotFoundE
} else {
throw new UsernameNotFoundException("Client not found: " + clientId);
}
} catch (UnsupportedEncodingException | InvalidClientException e) {
} catch (IllegalArgumentException | InvalidClientException e) {
throw new UsernameNotFoundException("Client not found: " + clientId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import java.util.List;
import java.util.Locale;

import javax.annotation.PostConstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.StringUtils;

import com.google.common.collect.Lists;
Expand All @@ -40,7 +39,7 @@
* @author AANGANES
*
*/
public class ConfigurationPropertiesBean {
public class ConfigurationPropertiesBean implements InitializingBean {

/**
* Logger for this class
Expand Down Expand Up @@ -72,14 +71,16 @@ public class ConfigurationPropertiesBean {
private boolean allowCompleteDeviceCodeUri = false;

public ConfigurationPropertiesBean() {

}

@Override
public void afterPropertiesSet() throws Exception {
checkConfigConsistency();
}
/**
* Endpoints protected by TLS must have https scheme in the URI.
* @throws HttpsUrlRequiredException
* @throws BeanCreationException
*/
@PostConstruct
public void checkConfigConsistency() {
if (!StringUtils.startsWithIgnoreCase(issuer, "https")) {
if (this.forceHttps) {
Expand Down Expand Up @@ -273,4 +274,6 @@ public boolean isAllowCompleteDeviceCodeUri() {
public void setAllowCompleteDeviceCodeUri(boolean allowCompleteDeviceCodeUri) {
this.allowCompleteDeviceCodeUri = allowCompleteDeviceCodeUri;
}


}
Loading