add basic suppport for client_credentials oauth grant
This commit is contained in:
parent
049f4a56de
commit
8995213d26
20 changed files with 627 additions and 58 deletions
23
Foxchat.Identity/Utils/OauthUtils.cs
Normal file
23
Foxchat.Identity/Utils/OauthUtils.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
namespace Foxchat.Identity.Utils;
|
||||
|
||||
public static class OauthUtils
|
||||
{
|
||||
public static readonly string[] Scopes = ["identify", "chat_client"];
|
||||
|
||||
private static readonly string[] ForbiddenSchemes = ["javascript", "file", "data", "mailto", "tel"];
|
||||
private const string OobUri = "urn:ietf:wg:oauth:2.0:oob";
|
||||
|
||||
public static bool ValidateRedirectUri(string uri)
|
||||
{
|
||||
if (uri == OobUri) return true;
|
||||
try
|
||||
{
|
||||
var scheme = new Uri(uri).Scheme;
|
||||
return !ForbiddenSchemes.Contains(scheme);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue