Polish gh-376

This commit is contained in:
Joe Grandja
2021-07-28 06:07:52 -04:00
parent 3ea7d8c9b6
commit 7f294abfbb

View File

@@ -232,7 +232,7 @@ public final class OAuth2AuthorizationCodeRequestAuthenticationProvider implemen
.build(); .build();
} }
OAuth2AuthorizationCode authorizationCode = createAuthorizationCode(); OAuth2AuthorizationCode authorizationCode = generateAuthorizationCode();
OAuth2Authorization authorization = authorizationBuilder(registeredClient, principal, authorizationRequest) OAuth2Authorization authorization = authorizationBuilder(registeredClient, principal, authorizationRequest)
.token(authorizationCode) .token(authorizationCode)
.attribute(OAuth2Authorization.AUTHORIZED_SCOPE_ATTRIBUTE_NAME, authorizationRequest.getScopes()) .attribute(OAuth2Authorization.AUTHORIZED_SCOPE_ATTRIBUTE_NAME, authorizationRequest.getScopes())
@@ -268,7 +268,7 @@ public final class OAuth2AuthorizationCodeRequestAuthenticationProvider implemen
DEFAULT_AUTHENTICATION_VALIDATOR_RESOLVER.apply(parameterName); DEFAULT_AUTHENTICATION_VALIDATOR_RESOLVER.apply(parameterName);
} }
private OAuth2AuthorizationCode createAuthorizationCode() { private OAuth2AuthorizationCode generateAuthorizationCode() {
Instant issuedAt = Instant.now(); Instant issuedAt = Instant.now();
Instant expiresAt = issuedAt.plus(5, ChronoUnit.MINUTES); // TODO Allow configuration for authorization code time-to-live Instant expiresAt = issuedAt.plus(5, ChronoUnit.MINUTES); // TODO Allow configuration for authorization code time-to-live
return new OAuth2AuthorizationCode(this.authorizationCodeGenerator.get(), issuedAt, expiresAt); return new OAuth2AuthorizationCode(this.authorizationCodeGenerator.get(), issuedAt, expiresAt);
@@ -345,7 +345,7 @@ public final class OAuth2AuthorizationCodeRequestAuthenticationProvider implemen
this.authorizationConsentService.save(authorizationConsent); this.authorizationConsentService.save(authorizationConsent);
} }
OAuth2AuthorizationCode authorizationCode = createAuthorizationCode(); OAuth2AuthorizationCode authorizationCode = generateAuthorizationCode();
OAuth2Authorization updatedAuthorization = OAuth2Authorization.from(authorization) OAuth2Authorization updatedAuthorization = OAuth2Authorization.from(authorization)
.token(authorizationCode) .token(authorizationCode)