io.muserver.openapi.OAuthFlowObjectBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mu-server Show documentation
Show all versions of mu-server Show documentation
A simple but powerful web server framework
package io.muserver.openapi;
import java.net.URI;
import java.util.Map;
/**
* Configuration details for a supported OAuth Flow
*/
public class OAuthFlowObjectBuilder {
private URI authorizationUrl;
private URI tokenUrl;
private URI refreshUrl;
private Map scopes;
/**
* @param authorizationUrl REQUIRED. The authorization URL to be used for this flow.
* @return The current builder
*/
public OAuthFlowObjectBuilder withAuthorizationUrl(URI authorizationUrl) {
this.authorizationUrl = authorizationUrl;
return this;
}
/**
* @param tokenUrl REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
* @return The current builder
*/
public OAuthFlowObjectBuilder withTokenUrl(URI tokenUrl) {
this.tokenUrl = tokenUrl;
return this;
}
/**
* @param refreshUrl The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
* @return The current builder
*/
public OAuthFlowObjectBuilder withRefreshUrl(URI refreshUrl) {
this.refreshUrl = refreshUrl;
return this;
}
/**
* @param scopes REQUIRED. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it.
* @return The current builder
*/
public OAuthFlowObjectBuilder withScopes(Map scopes) {
this.scopes = scopes;
return this;
}
public OAuthFlowObject build() {
return new OAuthFlowObject(authorizationUrl, tokenUrl, refreshUrl, scopes);
}
/**
* Creates a builder for an {@link OAuthFlowObject}
*
* @return A new builder
*/
public static OAuthFlowObjectBuilder oAuthFlowObject() {
return new OAuthFlowObjectBuilder();
}
}