oauth2.1 flow test
parent
3e6be99411
commit
71e6607b85
|
@ -72,6 +72,7 @@ public class ClientSettingsDto implements Serializable {
|
||||||
public ClientSettings toSettings() {
|
public ClientSettings toSettings() {
|
||||||
ClientSettings.Builder builder = ClientSettings.builder()
|
ClientSettings.Builder builder = ClientSettings.builder()
|
||||||
.requireProofKey(requireProofKey)
|
.requireProofKey(requireProofKey)
|
||||||
|
.requireAuthorizationConsent(requireAuthorizationConsent)
|
||||||
.tokenEndpointAuthenticationSigningAlgorithm(SignatureAlgorithm.valueOf(tokenEndpointAuthenticationSigningAlgorithm));
|
.tokenEndpointAuthenticationSigningAlgorithm(SignatureAlgorithm.valueOf(tokenEndpointAuthenticationSigningAlgorithm));
|
||||||
if (StringUtils.isNotBlank(jwkSetUrl)) {
|
if (StringUtils.isNotBlank(jwkSetUrl)) {
|
||||||
builder.jwkSetUrl(jwkSetUrl);
|
builder.jwkSetUrl(jwkSetUrl);
|
||||||
|
|
|
@ -13,6 +13,8 @@ import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.springframework.security.oauth2.core.AuthorizationGrantType.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Shengzhao Li
|
* @author Shengzhao Li
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
@ -203,7 +205,7 @@ public class OauthClientDetailsDto implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
public boolean isContainsAuthorizationCode() {
|
public boolean isContainsAuthorizationCode() {
|
||||||
if (!this.authorizationGrantTypes.contains("authorization_code")) {
|
if (!this.authorizationGrantTypes.contains(AUTHORIZATION_CODE.getValue())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (clientSettings == null) {
|
if (clientSettings == null) {
|
||||||
|
@ -218,7 +220,7 @@ public class OauthClientDetailsDto implements Serializable {
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
public boolean isContainsAuthorizationCodeWithPKCE() {
|
public boolean isContainsAuthorizationCodeWithPKCE() {
|
||||||
if (!isContainsAuthorizationCode()) {
|
if (!this.authorizationGrantTypes.contains(AUTHORIZATION_CODE.getValue())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return clientSettings != null && clientSettings.isRequireProofKey();
|
return clientSettings != null && clientSettings.isRequireProofKey();
|
||||||
|
@ -230,7 +232,7 @@ public class OauthClientDetailsDto implements Serializable {
|
||||||
* @deprecated from OAuth2.1
|
* @deprecated from OAuth2.1
|
||||||
*/
|
*/
|
||||||
public boolean isContainsPassword() {
|
public boolean isContainsPassword() {
|
||||||
return this.authorizationGrantTypes.contains("password");
|
return this.authorizationGrantTypes.contains(PASSWORD.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// public boolean isContainsImplicit() {
|
// public boolean isContainsImplicit() {
|
||||||
|
@ -238,25 +240,25 @@ public class OauthClientDetailsDto implements Serializable {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public boolean isContainsClientCredentials() {
|
public boolean isContainsClientCredentials() {
|
||||||
return this.authorizationGrantTypes.contains("client_credentials");
|
return this.authorizationGrantTypes.contains(CLIENT_CREDENTIALS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isContainsRefreshToken() {
|
public boolean isContainsRefreshToken() {
|
||||||
return this.authorizationGrantTypes.contains("refresh_token");
|
return this.authorizationGrantTypes.contains(REFRESH_TOKEN.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
public boolean isContainsDeviceCode() {
|
public boolean isContainsDeviceCode() {
|
||||||
return this.authorizationGrantTypes.contains("device_code");
|
return this.authorizationGrantTypes.contains(DEVICE_CODE.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
public boolean isContainsJwtBearer() {
|
public boolean isContainsJwtBearer() {
|
||||||
return this.authorizationGrantTypes.contains("jwt-bearer");
|
return this.authorizationGrantTypes.contains(JWT_BEARER.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue