added registration uri to server config, changed index of client config service to be server config not just issuer
parent
fc1088c841
commit
cf39b49657
|
@ -152,6 +152,11 @@ public class OIDCAuthenticationFilter extends AbstractAuthenticationProcessingFi
|
|||
|
||||
IssuerServiceResponse issResp = issuerService.getIssuer(request);
|
||||
|
||||
if (issResp == null) {
|
||||
logger.error("Null issuer response returned from service.");
|
||||
throw new AuthenticationServiceException("No issuer found.");
|
||||
}
|
||||
|
||||
if (issResp.shouldRedirect()) {
|
||||
response.sendRedirect(issResp.getRedirectUrl());
|
||||
} else {
|
||||
|
@ -171,7 +176,7 @@ public class OIDCAuthenticationFilter extends AbstractAuthenticationProcessingFi
|
|||
}
|
||||
|
||||
|
||||
ClientDetails clientConfig = clients.getClientConfiguration(issuer);
|
||||
ClientDetails clientConfig = clients.getClientConfiguration(serverConfig);
|
||||
if (clientConfig == null) {
|
||||
logger.error("No client configuration found for issuer: " + issuer);
|
||||
throw new AuthenticationServiceException("No client configuration found for issuer: " + issuer);
|
||||
|
@ -222,7 +227,7 @@ public class OIDCAuthenticationFilter extends AbstractAuthenticationProcessingFi
|
|||
|
||||
// pull the configurations based on that issuer
|
||||
ServerConfiguration serverConfig = servers.getServerConfiguration(issuer);
|
||||
ClientDetails clientConfig = clients.getClientConfiguration(issuer);
|
||||
ClientDetails clientConfig = clients.getClientConfiguration(serverConfig);
|
||||
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
form.add("grant_type", "authorization_code");
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
package org.mitre.openid.connect.client.service;
|
||||
|
||||
import org.mitre.openid.connect.config.ServerConfiguration;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
|
||||
/**
|
||||
|
@ -11,6 +12,6 @@ import org.springframework.security.oauth2.provider.ClientDetails;
|
|||
*/
|
||||
public interface ClientConfigurationService {
|
||||
|
||||
public ClientDetails getClientConfiguration(String issuer);
|
||||
public ClientDetails getClientConfiguration(ServerConfiguration issuer);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.mitre.openid.connect.client.service.impl;
|
|||
import java.util.Map;
|
||||
|
||||
import org.mitre.openid.connect.client.service.ClientConfigurationService;
|
||||
import org.mitre.openid.connect.config.ServerConfiguration;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
|
||||
|
@ -42,9 +43,9 @@ public class StaticClientConfigurationService implements ClientConfigurationServ
|
|||
* @see org.mitre.openid.connect.client.service.ClientConfigurationService#getClientConfiguration(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public ClientDetails getClientConfiguration(String issuer) {
|
||||
public ClientDetails getClientConfiguration(ServerConfiguration issuer) {
|
||||
|
||||
return clients.get(issuer);
|
||||
return clients.get(issuer.getIssuer());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -29,6 +29,8 @@ public class ServerConfiguration {
|
|||
private String authorizationEndpointUri;
|
||||
|
||||
private String tokenEndpointUri;
|
||||
|
||||
private String registrationEndpointUri;
|
||||
|
||||
private String issuer;
|
||||
|
||||
|
@ -105,5 +107,96 @@ public class ServerConfiguration {
|
|||
public void setUserInfoUri(String userInfoUri) {
|
||||
this.userInfoUri = userInfoUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the registrationEndpointUri
|
||||
*/
|
||||
public String getRegistrationEndpointUri() {
|
||||
return registrationEndpointUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param registrationEndpointUri the registrationEndpointUri to set
|
||||
*/
|
||||
public void setRegistrationEndpointUri(String registrationEndpointUri) {
|
||||
this.registrationEndpointUri = registrationEndpointUri;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((authorizationEndpointUri == null) ? 0 : authorizationEndpointUri.hashCode());
|
||||
result = prime * result + ((issuer == null) ? 0 : issuer.hashCode());
|
||||
result = prime * result + ((jwksUri == null) ? 0 : jwksUri.hashCode());
|
||||
result = prime * result + ((registrationEndpointUri == null) ? 0 : registrationEndpointUri.hashCode());
|
||||
result = prime * result + ((tokenEndpointUri == null) ? 0 : tokenEndpointUri.hashCode());
|
||||
result = prime * result + ((userInfoUri == null) ? 0 : userInfoUri.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ServerConfiguration other = (ServerConfiguration) obj;
|
||||
if (authorizationEndpointUri == null) {
|
||||
if (other.authorizationEndpointUri != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!authorizationEndpointUri.equals(other.authorizationEndpointUri)) {
|
||||
return false;
|
||||
}
|
||||
if (issuer == null) {
|
||||
if (other.issuer != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!issuer.equals(other.issuer)) {
|
||||
return false;
|
||||
}
|
||||
if (jwksUri == null) {
|
||||
if (other.jwksUri != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!jwksUri.equals(other.jwksUri)) {
|
||||
return false;
|
||||
}
|
||||
if (registrationEndpointUri == null) {
|
||||
if (other.registrationEndpointUri != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!registrationEndpointUri.equals(other.registrationEndpointUri)) {
|
||||
return false;
|
||||
}
|
||||
if (tokenEndpointUri == null) {
|
||||
if (other.tokenEndpointUri != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!tokenEndpointUri.equals(other.tokenEndpointUri)) {
|
||||
return false;
|
||||
}
|
||||
if (userInfoUri == null) {
|
||||
if (other.userInfoUri != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!userInfoUri.equals(other.userInfoUri)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue