commit | author | age
|
7ecde3
|
1 |
/* |
U |
2 |
http-oauth - OAuth Extensions to jdk.httpserver |
|
3 |
Copyright (C) 2021 Ulrich Hilger |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU Affero General Public License as |
|
7 |
published by the Free Software Foundation, either version 3 of the |
|
8 |
License, or (at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU Affero General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU Affero General Public License |
|
16 |
along with this program. If not, see <https://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
package de.uhilger.httpserver.oauth; |
|
19 |
|
|
20 |
import com.google.gson.Gson; |
|
21 |
|
|
22 |
/** |
|
23 |
* Die Klasse LoginResponse modelliert die Antwort auf eine HTTP-Anfrage |
|
24 |
* gemaess Bearer Authentication nach RFC 6750 |
|
25 |
* |
|
26 |
* @author Ulrich Hilger |
|
27 |
* @version 1, 08.6.2021 |
|
28 |
*/ |
|
29 |
public class LoginResponse { |
|
30 |
/* |
|
31 |
HTTP/1.1 200 OK |
|
32 |
Content-Type: application/json;charset=UTF-8 |
|
33 |
Cache-Control: no-store |
|
34 |
Pragma: no-cache |
|
35 |
|
|
36 |
{ |
|
37 |
"access_token":"mF_9.B5f-4.1JqM", |
|
38 |
"token_type":"Bearer", |
|
39 |
"expires_in":3600, |
|
40 |
"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA" |
|
41 |
} |
|
42 |
*/ |
|
43 |
|
|
44 |
private String access_token; |
|
45 |
private final String token_type = BearerAuthenticator.BEARER; |
|
46 |
private long expires_in; |
|
47 |
private String refresh_token; |
|
48 |
|
|
49 |
public String getToken() { |
|
50 |
return access_token; |
|
51 |
} |
|
52 |
|
|
53 |
public void setToken(String token) { |
|
54 |
this.access_token = token; |
|
55 |
} |
|
56 |
|
|
57 |
public String getRefreshToken() { |
|
58 |
return refresh_token; |
|
59 |
} |
|
60 |
|
|
61 |
public void setRefreshToken(String refreshToken) { |
|
62 |
this.refresh_token = refreshToken; |
|
63 |
} |
|
64 |
|
|
65 |
public String getTokenType() { |
|
66 |
return token_type; |
|
67 |
} |
|
68 |
|
|
69 |
public long getExpiresIn() { |
|
70 |
return expires_in; |
|
71 |
} |
|
72 |
|
|
73 |
public void setExpiresIn(long seconds) { |
|
74 |
this.expires_in = seconds; |
|
75 |
} |
|
76 |
|
|
77 |
|
|
78 |
public String toJson() { |
|
79 |
Gson gson = new Gson(); |
|
80 |
return gson.toJson(this); |
|
81 |
} |
|
82 |
} |