mirror of
https://github.com/ysoftdevs/oauth-playground-server.git
synced 2026-03-17 23:04:21 +01:00
allow multiple redirect uris per client
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
package com.ysoft.geecon.dto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public record OAuthClient(String clientId, String description, String clientSecret, String redirectUri) {
|
||||
public record OAuthClient(String clientId, String description, String clientSecret, List<String> redirectUris) {
|
||||
public boolean validateRedirectUri(String redirectUri) {
|
||||
return this.redirectUri != null && this.redirectUri.equals(redirectUri);
|
||||
return this.redirectUris != null && this.redirectUris.contains(redirectUri);
|
||||
}
|
||||
|
||||
public boolean validateSecret(String clientSecret) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.ysoft.geecon.dto.OAuthClient;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -13,11 +14,15 @@ public class ClientsRepo {
|
||||
private final Map<String, OAuthClient> clients = new HashMap<>();
|
||||
|
||||
public ClientsRepo() {
|
||||
register(new OAuthClient("my-public-client", "Example public client", null, "https://localhost:8888/oauth_success"));
|
||||
register(new OAuthClient("oauthdebugger", "Example public client", null, "https://oauthdebugger.com/debug"));
|
||||
register(new OAuthClient("my-public-client", "Example public client", null,
|
||||
List.of("https://localhost:8888/oauth_success")));
|
||||
register(new OAuthClient("oauthdebugger", "Example public client", null,
|
||||
List.of("https://oauthdebugger.com/debug")));
|
||||
|
||||
register(new OAuthClient("oauth-playground", "OAuth playground", null, "https://oauth-playground.online/flow/code-2"));
|
||||
register(new OAuthClient("oauth-playground-localhost", "OAuth playground", null, "http://localhost:5555/flow/code-2"));
|
||||
register(new OAuthClient("oauth-playground", "OAuth playground", null,
|
||||
List.of("https://oauth-playground.online/flow/code-2", "https://oauth-playground.online/flow/pkce-3")));
|
||||
register(new OAuthClient("oauth-playground-localhost", "OAuth playground", null,
|
||||
List.of("http://localhost:5555/flow/code-2", "http://localhost:5555/flow/pkce-2")));
|
||||
}
|
||||
|
||||
public Optional<OAuthClient> getClient(String clientId) {
|
||||
|
||||
Reference in New Issue
Block a user