-
Notifications
You must be signed in to change notification settings - Fork 156
Expand file tree
/
Copy pathOidcDiscoveryResponse.java
More file actions
72 lines (61 loc) · 2.38 KB
/
OidcDiscoveryResponse.java
File metadata and controls
72 lines (61 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.aad.msal4j;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
class OidcDiscoveryResponse implements JsonSerializable<OidcDiscoveryResponse> {
private String authorizationEndpoint;
private String tokenEndpoint;
private String deviceCodeEndpoint;
private String issuer;
public static OidcDiscoveryResponse fromJson(JsonReader jsonReader) throws IOException {
OidcDiscoveryResponse response = new OidcDiscoveryResponse();
return jsonReader.readObject(reader -> {
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
switch (fieldName) {
case "authorization_endpoint":
response.authorizationEndpoint = reader.getString();
break;
case "token_endpoint":
response.tokenEndpoint = reader.getString();
break;
case "device_authorization_endpoint":
response.deviceCodeEndpoint = reader.getString();
break;
case "issuer":
response.issuer = reader.getString();
break;
default:
reader.skipChildren();
break;
}
}
return response;
});
}
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("authorization_endpoint", authorizationEndpoint);
jsonWriter.writeStringField("token_endpoint", tokenEndpoint);
jsonWriter.writeStringField("device_authorization_endpoint", deviceCodeEndpoint);
jsonWriter.writeEndObject();
return jsonWriter;
}
String authorizationEndpoint() {
return this.authorizationEndpoint;
}
String tokenEndpoint() {
return this.tokenEndpoint;
}
String deviceCodeEndpoint() {
return this.deviceCodeEndpoint;
}
String issuer() {
return this.issuer;
}
}