forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#10417 from sberyozkin/oidc_user_info
OIDC UserInfo support
- Loading branch information
Showing
14 changed files
with
350 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
extensions/oidc/runtime/src/main/java/io/quarkus/oidc/UserInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.quarkus.oidc; | ||
|
||
import java.io.StringReader; | ||
|
||
import javax.json.Json; | ||
import javax.json.JsonArray; | ||
import javax.json.JsonObject; | ||
import javax.json.JsonReader; | ||
|
||
public class UserInfo { | ||
|
||
private JsonObject json; | ||
|
||
public UserInfo() { | ||
} | ||
|
||
public UserInfo(String userInfoJson) { | ||
json = toJsonObject(userInfoJson); | ||
} | ||
|
||
public String getString(String name) { | ||
return json.getString(name); | ||
} | ||
|
||
public JsonArray getArray(String name) { | ||
return json.getJsonArray(name); | ||
} | ||
|
||
public JsonObject getObject(String name) { | ||
return json.getJsonObject(name); | ||
} | ||
|
||
public Object get(String name) { | ||
return json.get(name); | ||
} | ||
|
||
private static JsonObject toJsonObject(String userInfoJson) { | ||
try (JsonReader jsonReader = Json.createReader(new StringReader(userInfoJson))) { | ||
return jsonReader.readObject(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.