/* http-oauth - OAuth Extensions to jdk.httpserver Copyright (C) 2021 Ulrich Hilger This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ package de.uhilger.httpserver.oauth; import com.google.gson.Gson; /** * Die Klasse LoginResponse modelliert die Antwort auf eine HTTP-Anfrage * gemaess Bearer Authentication nach RFC 6750 * * @author Ulrich Hilger * @version 1, 08.6.2021 */ public class LoginResponse { /* HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "access_token":"mF_9.B5f-4.1JqM", "token_type":"Bearer", "expires_in":3600, "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA" } */ private String access_token; private final String token_type = BearerAuthenticator.BEARER; private long expires_in; private String refresh_token; public String getToken() { return access_token; } public void setToken(String token) { this.access_token = token; } public String getRefreshToken() { return refresh_token; } public void setRefreshToken(String refreshToken) { this.refresh_token = refreshToken; } public String getTokenType() { return token_type; } public long getExpiresIn() { return expires_in; } public void setExpiresIn(long seconds) { this.expires_in = seconds; } public String toJson() { Gson gson = new Gson(); return gson.toJson(this); } }