|
@@ -15,11 +15,7 @@
|
|
|
*/
|
|
|
package org.springframework.security.oauth2.server.authorization.context;
|
|
|
|
|
|
-import java.util.function.Supplier;
|
|
|
-
|
|
|
-import org.springframework.lang.Nullable;
|
|
|
import org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings;
|
|
|
-import org.springframework.util.Assert;
|
|
|
|
|
|
/**
|
|
|
* A context that holds information of the Authorization Server runtime environment.
|
|
@@ -29,42 +25,20 @@ import org.springframework.util.Assert;
|
|
|
* @see AuthorizationServerSettings
|
|
|
* @see AuthorizationServerContextHolder
|
|
|
*/
|
|
|
-public final class AuthorizationServerContext {
|
|
|
- private final AuthorizationServerSettings authorizationServerSettings;
|
|
|
- private final Supplier<String> issuerSupplier;
|
|
|
+public interface AuthorizationServerContext {
|
|
|
|
|
|
/**
|
|
|
- * Constructs an {@code AuthorizationServerContext} using the provided parameters.
|
|
|
+ * Returns the {@code URL} of the Authorization Server's issuer identifier.
|
|
|
*
|
|
|
- * @param authorizationServerSettings the authorization server settings
|
|
|
- * @param issuerSupplier a {@code Supplier} for the {@code URL} of the Authorization Server's issuer identifier
|
|
|
+ * @return the {@code URL} of the Authorization Server's issuer identifier
|
|
|
*/
|
|
|
- public AuthorizationServerContext(AuthorizationServerSettings authorizationServerSettings, @Nullable Supplier<String> issuerSupplier) {
|
|
|
- Assert.notNull(authorizationServerSettings, "authorizationServerSettings cannot be null");
|
|
|
- this.authorizationServerSettings = authorizationServerSettings;
|
|
|
- this.issuerSupplier = issuerSupplier;
|
|
|
- }
|
|
|
+ String getIssuer();
|
|
|
|
|
|
/**
|
|
|
* Returns the {@link AuthorizationServerSettings}.
|
|
|
*
|
|
|
* @return the {@link AuthorizationServerSettings}
|
|
|
*/
|
|
|
- public AuthorizationServerSettings getAuthorizationServerSettings() {
|
|
|
- return this.authorizationServerSettings;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Returns the {@code URL} of the Authorization Server's issuer identifier.
|
|
|
- * The issuer identifier is resolved from the constructor parameter {@code Supplier<String>}
|
|
|
- * or if not provided then defaults to {@link AuthorizationServerSettings#getIssuer()}.
|
|
|
- *
|
|
|
- * @return the {@code URL} of the Authorization Server's issuer identifier
|
|
|
- */
|
|
|
- public String getIssuer() {
|
|
|
- return this.issuerSupplier != null ?
|
|
|
- this.issuerSupplier.get() :
|
|
|
- getAuthorizationServerSettings().getIssuer();
|
|
|
- }
|
|
|
+ AuthorizationServerSettings getAuthorizationServerSettings();
|
|
|
|
|
|
}
|