nl.reinkrul.nuts.auth.RequestAccessTokenRequest 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 and use it as authorization grant to get the access token from the authorizer
*/
@JsonPropertyOrder({
RequestAccessTokenRequest.JSON_PROPERTY_AUTHORIZER,
RequestAccessTokenRequest.JSON_PROPERTY_REQUESTER,
RequestAccessTokenRequest.JSON_PROPERTY_IDENTITY,
RequestAccessTokenRequest.JSON_PROPERTY_SERVICE,
RequestAccessTokenRequest.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 RequestAccessTokenRequest {
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 RequestAccessTokenRequest() {
}
public RequestAccessTokenRequest 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 RequestAccessTokenRequest 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 RequestAccessTokenRequest 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 RequestAccessTokenRequest 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 RequestAccessTokenRequest credentials(List credentials) {
this.credentials = credentials;
return this;
}
public RequestAccessTokenRequest addCredentialsItem(nl.reinkrul.nuts.common.VerifiableCredential credentialsItem) {
if (this.credentials == null) {
this.credentials = new ArrayList<>();
}
this.credentials.add(credentialsItem);
return this;
}
/**
* Verifiable Credentials to be included in the access token. If no VCs are to be included in the access token, the array can be left empty.
* @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 RequestAccessTokenRequest object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RequestAccessTokenRequest requestAccessTokenRequest = (RequestAccessTokenRequest) o;
return Objects.equals(this.authorizer, requestAccessTokenRequest.authorizer) &&
Objects.equals(this.requester, requestAccessTokenRequest.requester) &&
Objects.equals(this.identity, requestAccessTokenRequest.identity) &&
Objects.equals(this.service, requestAccessTokenRequest.service) &&
Objects.equals(this.credentials, requestAccessTokenRequest.credentials);
}
@Override
public int hashCode() {
return Objects.hash(authorizer, requester, identity, service, credentials);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RequestAccessTokenRequest {\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