io.muserver.openapi.SecurityRequirementObjectBuilder 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.util.List;
import java.util.Map;
/**
* Lists the required security schemes to execute this operation. The name used for each property MUST correspond to
* a security scheme declared in the {@link SecuritySchemeObject} under the {@link ComponentsObject}.
*
* Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request
* to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to
* convey security information.
*
* When a list of Security Requirement Objects is defined on the {@link OpenAPIObject} or
* {@link OperationObject}, only one of Security Requirement Objects in the list needs to be
* satisfied to authorize the request.
*/
public class SecurityRequirementObjectBuilder {
private Map> requirements;
/**
* @param requirements Each name MUST correspond to a security scheme which is declared in the {@link ComponentsObject#securitySchemes}
* under the {@link ComponentsObject}. If the security scheme is of type "oauth2"
or
* "openIdConnect"
, then the value is a list of scope names required for the execution.
* For other security scheme types, the array MUST be empty.
* @return The builder
*/
public SecurityRequirementObjectBuilder withRequirements(Map> requirements) {
this.requirements = requirements;
return this;
}
public SecurityRequirementObject build() {
return new SecurityRequirementObject(requirements);
}
/**
* Creates a builder for a {@link SecurityRequirementObjectBuilder}
*
* @return A new builder
*/
public static SecurityRequirementObjectBuilder securityRequirementObject() {
return new SecurityRequirementObjectBuilder();
}
}