|
|
|
@ -30,6 +30,9 @@ import java.util.stream.Collectors; |
|
|
|
*/ |
|
|
|
public class DiscordIdentityProviderConfig extends OAuth2IdentityProviderConfig { |
|
|
|
|
|
|
|
public static final String ALLOWED_GUILDS = "allowedGuilds"; |
|
|
|
public static final String PROMPT = "prompt"; |
|
|
|
|
|
|
|
public DiscordIdentityProviderConfig(IdentityProviderModel model) { |
|
|
|
super(model); |
|
|
|
} |
|
|
|
@ -38,27 +41,27 @@ public class DiscordIdentityProviderConfig extends OAuth2IdentityProviderConfig |
|
|
|
} |
|
|
|
|
|
|
|
public String getAllowedGuilds() { |
|
|
|
return getConfig().get("allowedGuilds"); |
|
|
|
return getConfig().get(ALLOWED_GUILDS); |
|
|
|
} |
|
|
|
|
|
|
|
public void setAllowedGuilds(String allowedGuilds) { |
|
|
|
getConfig().put("allowedGuilds", allowedGuilds); |
|
|
|
getConfig().put(ALLOWED_GUILDS, allowedGuilds); |
|
|
|
} |
|
|
|
|
|
|
|
public boolean hasAllowedGuilds() { |
|
|
|
String guilds = getConfig().get("allowedGuilds"); |
|
|
|
String guilds = getConfig().get(ALLOWED_GUILDS); |
|
|
|
return guilds != null && !guilds.trim().isEmpty(); |
|
|
|
} |
|
|
|
|
|
|
|
public Set<String> getAllowedGuildsAsSet() { |
|
|
|
if (hasAllowedGuilds()) { |
|
|
|
String guilds = getConfig().get("allowedGuilds"); |
|
|
|
String guilds = getConfig().get(ALLOWED_GUILDS); |
|
|
|
return Arrays.stream(guilds.split(",")).map(x -> x.trim()).collect(Collectors.toSet()); |
|
|
|
} |
|
|
|
return Collections.emptySet(); |
|
|
|
} |
|
|
|
|
|
|
|
public void setPrompt(String prompt) { |
|
|
|
getConfig().put("prompt", prompt); |
|
|
|
getConfig().put(PROMPT, prompt); |
|
|
|
} |
|
|
|
} |