All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.authlete.common.dto.AuthorizationIssueRequest Maven / Gradle / Ivy

Go to download

Authlete Java library used commonly by service implementations and the Authlete server.

There is a newer version: 4.17
Show newest version
/*
 * Copyright (C) 2014-2015 Authlete, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.authlete.common.dto;


import java.io.Serializable;
import java.util.Map;
import com.authlete.common.util.Utils;


/**
 * Request to Authlete's {@code /auth/authorization/issue} API.
 *
 * 
*
*
ticket (REQUIRED)
*
*

* The ticket issued by Authlete's {@code /auth/authorization} API * to the service implementation. It is the value of {@code "ticket"} * contained in the response from Authlete's {@code * /auth/authorization} API ({@link AuthorizationResponse}). *

*
* *
subject (CONDITIONALLY REQUIRED)
*
*

* The subject (= a user account managed by the service) who has * granted authorization to the client application. This parameter * is required unless the authorization request has come with * {@code response_type=none} (which means the client application * did not request any token to be returned). See "4. None Response Type" in OAuth 2.0 Multiple Response Type Encoding Practices for * details about {@code response_type=none}. *

*
* *
authTime (OPTIONAL)
*
*

* The time when the authentication of the end-user occurred. *

*
* *
acr (OPTIONAL)
*
*

* The Authentication Context Class Reference performed for the * end-user authentication. *

*
* *
claims (OPTIONAL)
*
*

* The claims of the end-user (= pieces of information about the * end-user) in JSON format. See * OpenID Connect Core 1.0, 5.1. Standard Claims for details * about the format. *

*
*
*
* * @see AuthorizationResponse * * @see OpenID Connect Core 1.0, 5.1. Standard Claims * * @author Takahiko Kawasaki */ public class AuthorizationIssueRequest implements Serializable { private static final long serialVersionUID = 3L; /** * The ticket issued by Authlete's endpoint. */ private String ticket; /** * The subject (end-user) managed by the service. */ private String subject; /** * The time when the end-user was authenticated. */ private long authTime; /** * The authentication context class reference. */ private String acr; /** * Claims in JSON format. */ private String claims; /** * Get the value of {@code "ticket"} which is the ticket * issued by Authlete's {@code /auth/authorization} API * to the service implementation. * * @return * The ticket. */ public String getTicket() { return ticket; } /** * Set the value of {@code "ticket"} which is the ticket * issued by Authlete's {@code /auth/authorization} API * to the service implementation. * * @param ticket * The ticket. * * @return * {@code this} object. */ public AuthorizationIssueRequest setTicket(String ticket) { this.ticket = ticket; return this; } /** * Get the value of {@code "subject"} which is the subject * (= a user account managed by the service) who has granted * authorization to the client application. * * @return * The subject. */ public String getSubject() { return subject; } /** * Set the value of {@code "subject"} which is the subject * (= a user account managed by the service) who has granted * authorization to the client application. * * @param subject * The subject. * * @return * {@code this} object. */ public AuthorizationIssueRequest setSubject(String subject) { this.subject = subject; return this; } /** * Get the value of {@code "authTime"} which is the time * when the authentication of the end-user occurred. * * @return * The time when the end-user authentication occurred. * It is the number of seconds since 1970-01-01. */ public long getAuthTime() { return authTime; } /** * Set the value of {@code "authTime"} which is the time * when the authentication of the end-user occurred. * * @param authTime * The time when the end-user authentication occurred. * It is the number of seconds since 1970-01-01. * * @return * {@code this} object. */ public AuthorizationIssueRequest setAuthTime(long authTime) { this.authTime = authTime; return this; } /** * Get the value of {@code "acr"} which is the authentication * context class reference value which the end-user authentication * satisfied. * * @return * The authentication context class reference. */ public String getAcr() { return acr; } /** * Set the value of {@code "acr"} which is the authentication * context class reference value which the end-user authentication * satisfied. * * @param acr * The authentication context class reference. * * @return * {@code this} object. */ public AuthorizationIssueRequest setAcr(String acr) { this.acr = acr; return this; } /** * Get the value of {@code "claims"} which is the claims of the subject * in JSON format. * * @return * The claims of the subject in JSON format. See the description * of {@link #setClaims(String)} for details about the format. * * @see #setClaims(String) */ public String getClaims() { return claims; } /** * Set the value of {@code "claims"} which is the claims of the subject * in JSON format. * *

* The service implementation is required to retrieve claims of the subject * (= information about the end-user) from its database and format them in * JSON format. *

* *

* For example, if "given_name" claim, "family_name" * claim and "email" claim are requested, the service implementation * should generate a JSON object like the following: *

* *
     * {
     *   "given_name": "Takahiko",
     *   "family_name": "Kawasaki",
     *   "email": "[email protected]"
     * }
     * 
* *

* and set its String representation by this method. *

* *

* See OpenID Connect Core 1.0, 5.1. Standard Claims for further details * about the format. *

* * @param claims * The claims of the subject in JSON format. * * @return * {@code this} object. * * @see OpenID Connect Core 1.0, 5.1. Standard Claims */ public AuthorizationIssueRequest setClaims(String claims) { this.claims = claims; return this; } /** * Set the value of {@code "claims"} which is the claims of the subject. * The argument is converted into a JSON string and passed to {@link * #setClaims(String)} method. * * @param claims * The claims of the subject. Keys are claim names. * * @return * {@code this} object. * * @since 1.24 */ public AuthorizationIssueRequest setClaims(Map claims) { if (claims == null || claims.size() == 0) { this.claims = null; return this; } String json = Utils.toJson(claims); return setClaims(json); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy