nl.reinkrul.nuts.auth.CreateJwtGrantRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Java client library for using the Nuts Node's REST API.
/*
* Nuts Auth Service API spec
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package nl.reinkrul.nuts.auth;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Request for a JWT Grant. The grant can be used during a Access Token Request in the assertion field
*/
@JsonPropertyOrder({
CreateJwtGrantRequest.JSON_PROPERTY_AUTHORIZER,
CreateJwtGrantRequest.JSON_PROPERTY_REQUESTER,
CreateJwtGrantRequest.JSON_PROPERTY_IDENTITY,
CreateJwtGrantRequest.JSON_PROPERTY_SERVICE,
CreateJwtGrantRequest.JSON_PROPERTY_CREDENTIALS
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-12T15:13:45.138986+02:00[Europe/Amsterdam]")
public class CreateJwtGrantRequest {
public static final String JSON_PROPERTY_AUTHORIZER = "authorizer";
private String authorizer;
public static final String JSON_PROPERTY_REQUESTER = "requester";
private String requester;
public static final String JSON_PROPERTY_IDENTITY = "identity";
private nl.reinkrul.nuts.common.VerifiablePresentation identity;
public static final String JSON_PROPERTY_SERVICE = "service";
private String service;
public static final String JSON_PROPERTY_CREDENTIALS = "credentials";
private List credentials = new ArrayList<>();
public CreateJwtGrantRequest() {
}
public CreateJwtGrantRequest authorizer(String authorizer) {
this.authorizer = authorizer;
return this;
}
/**
* Get authorizer
* @return authorizer
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_AUTHORIZER)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getAuthorizer() {
return authorizer;
}
@JsonProperty(JSON_PROPERTY_AUTHORIZER)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setAuthorizer(String authorizer) {
this.authorizer = authorizer;
}
public CreateJwtGrantRequest requester(String requester) {
this.requester = requester;
return this;
}
/**
* Get requester
* @return requester
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_REQUESTER)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getRequester() {
return requester;
}
@JsonProperty(JSON_PROPERTY_REQUESTER)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setRequester(String requester) {
this.requester = requester;
}
public CreateJwtGrantRequest identity(nl.reinkrul.nuts.common.VerifiablePresentation identity) {
this.identity = identity;
return this;
}
/**
* Get identity
* @return identity
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_IDENTITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public nl.reinkrul.nuts.common.VerifiablePresentation getIdentity() {
return identity;
}
@JsonProperty(JSON_PROPERTY_IDENTITY)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setIdentity(nl.reinkrul.nuts.common.VerifiablePresentation identity) {
this.identity = identity;
}
public CreateJwtGrantRequest service(String service) {
this.service = service;
return this;
}
/**
* The service for which this access token can be used. The right oauth endpoint is selected based on the service.
* @return service
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_SERVICE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getService() {
return service;
}
@JsonProperty(JSON_PROPERTY_SERVICE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setService(String service) {
this.service = service;
}
public CreateJwtGrantRequest credentials(List credentials) {
this.credentials = credentials;
return this;
}
public CreateJwtGrantRequest addCredentialsItem(nl.reinkrul.nuts.common.VerifiableCredential credentialsItem) {
if (this.credentials == null) {
this.credentials = new ArrayList<>();
}
this.credentials.add(credentialsItem);
return this;
}
/**
* Get credentials
* @return credentials
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_CREDENTIALS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List getCredentials() {
return credentials;
}
@JsonProperty(JSON_PROPERTY_CREDENTIALS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setCredentials(List credentials) {
this.credentials = credentials;
}
/**
* Return true if this CreateJwtGrantRequest object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CreateJwtGrantRequest createJwtGrantRequest = (CreateJwtGrantRequest) o;
return Objects.equals(this.authorizer, createJwtGrantRequest.authorizer) &&
Objects.equals(this.requester, createJwtGrantRequest.requester) &&
Objects.equals(this.identity, createJwtGrantRequest.identity) &&
Objects.equals(this.service, createJwtGrantRequest.service) &&
Objects.equals(this.credentials, createJwtGrantRequest.credentials);
}
@Override
public int hashCode() {
return Objects.hash(authorizer, requester, identity, service, credentials);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateJwtGrantRequest {\n");
sb.append(" authorizer: ").append(toIndentedString(authorizer)).append("\n");
sb.append(" requester: ").append(toIndentedString(requester)).append("\n");
sb.append(" identity: ").append(toIndentedString(identity)).append("\n");
sb.append(" service: ").append(toIndentedString(service)).append("\n");
sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `authorizer` to the URL query string
if (getAuthorizer() != null) {
joiner.add(String.format("%sauthorizer%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAuthorizer()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `requester` to the URL query string
if (getRequester() != null) {
joiner.add(String.format("%srequester%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getRequester()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `identity` to the URL query string
if (getIdentity() != null) {
joiner.add(getIdentity().toUrlQueryString(prefix + "identity" + suffix));
}
// add `service` to the URL query string
if (getService() != null) {
joiner.add(String.format("%sservice%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getService()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `credentials` to the URL query string
if (getCredentials() != null) {
for (int i = 0; i < getCredentials().size(); i++) {
if (getCredentials().get(i) != null) {
joiner.add(getCredentials().get(i).toUrlQueryString(String.format("%scredentials%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
return joiner.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy