aboutsummaryrefslogtreecommitdiff
path: root/lib/Plugins.Essentials/src/Oauth
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Plugins.Essentials/src/Oauth')
-rw-r--r--lib/Plugins.Essentials/src/Oauth/IOAuth2Provider.cs44
-rw-r--r--lib/Plugins.Essentials/src/Oauth/OauthHttpExtensions.cs18
-rw-r--r--lib/Plugins.Essentials/src/Oauth/OauthSessionCacheExhaustedException.cs43
3 files changed, 9 insertions, 96 deletions
diff --git a/lib/Plugins.Essentials/src/Oauth/IOAuth2Provider.cs b/lib/Plugins.Essentials/src/Oauth/IOAuth2Provider.cs
deleted file mode 100644
index 30944b8..0000000
--- a/lib/Plugins.Essentials/src/Oauth/IOAuth2Provider.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* Copyright (c) 2022 Vaughn Nugent
-*
-* Library: VNLib
-* Package: VNLib.Plugins.Essentials
-* File: IOAuth2Provider.cs
-*
-* IOAuth2Provider.cs is part of VNLib.Plugins.Essentials which is part of the larger
-* VNLib collection of libraries and utilities.
-*
-* VNLib.Plugins.Essentials is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License as
-* published by the Free Software Foundation, either version 3 of the
-* License, or (at your option) any later version.
-*
-* VNLib.Plugins.Essentials is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see https://www.gnu.org/licenses/.
-*/
-
-using System;
-using System.Threading.Tasks;
-
-using VNLib.Plugins.Essentials.Sessions;
-
-namespace VNLib.Plugins.Essentials.Oauth
-{
- /// <summary>
- /// An interface that Oauth2 serice providers must implement
- /// to provide sessions to an <see cref="EventProcessor"/>
- /// processor endpoint processor
- /// </summary>
- public interface IOAuth2Provider : ISessionProvider
- {
- /// <summary>
- /// Gets a value indicating how long a session may be valid for
- /// </summary>
- public TimeSpan MaxTokenLifetime { get; }
- }
-} \ No newline at end of file
diff --git a/lib/Plugins.Essentials/src/Oauth/OauthHttpExtensions.cs b/lib/Plugins.Essentials/src/Oauth/OauthHttpExtensions.cs
index 11ab61a..3bce1f6 100644
--- a/lib/Plugins.Essentials/src/Oauth/OauthHttpExtensions.cs
+++ b/lib/Plugins.Essentials/src/Oauth/OauthHttpExtensions.cs
@@ -134,15 +134,15 @@ namespace VNLib.Plugins.Essentials.Oauth
//Set the error result in the header
ev.Server.Headers[HttpResponseHeader.WwwAuthenticate] = error switch
{
- ErrorType.InvalidRequest => $"Bearer error=\"invalid_request\"",
- ErrorType.UnauthorizedClient => $"Bearer error=\"unauthorized_client\"",
- ErrorType.UnsupportedResponseType => $"Bearer error=\"unsupported_response_type\"",
- ErrorType.InvalidScope => $"Bearer error=\"invalid_scope\"",
- ErrorType.ServerError => $"Bearer error=\"server_error\"",
- ErrorType.TemporarilyUnabavailable => $"Bearer error=\"temporarily_unavailable\"",
- ErrorType.InvalidClient => $"Bearer error=\"invalid_client\"",
- ErrorType.InvalidToken => $"Bearer error=\"invalid_token\"",
- _ => $"Bearer error=\"error\"",
+ ErrorType.InvalidRequest => "Bearer error=\"invalid_request\"",
+ ErrorType.UnauthorizedClient => "Bearer error=\"unauthorized_client\"",
+ ErrorType.UnsupportedResponseType => "Bearer error=\"unsupported_response_type\"",
+ ErrorType.InvalidScope => "Bearer error=\"invalid_scope\"",
+ ErrorType.ServerError => "Bearer error=\"server_error\"",
+ ErrorType.TemporarilyUnabavailable => "Bearer error=\"temporarily_unavailable\"",
+ ErrorType.InvalidClient => "Bearer error=\"invalid_client\"",
+ ErrorType.InvalidToken => "Bearer error=\"invalid_token\"",
+ _ => "Bearer error=\"error\"",
};
//Close the response with the status code
ev.CloseResponse(code);
diff --git a/lib/Plugins.Essentials/src/Oauth/OauthSessionCacheExhaustedException.cs b/lib/Plugins.Essentials/src/Oauth/OauthSessionCacheExhaustedException.cs
deleted file mode 100644
index da91444..0000000
--- a/lib/Plugins.Essentials/src/Oauth/OauthSessionCacheExhaustedException.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* Copyright (c) 2022 Vaughn Nugent
-*
-* Library: VNLib
-* Package: VNLib.Plugins.Essentials
-* File: OauthSessionCacheExhaustedException.cs
-*
-* OauthSessionCacheExhaustedException.cs is part of VNLib.Plugins.Essentials which is part of the larger
-* VNLib collection of libraries and utilities.
-*
-* VNLib.Plugins.Essentials is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License as
-* published by the Free Software Foundation, either version 3 of the
-* License, or (at your option) any later version.
-*
-* VNLib.Plugins.Essentials is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see https://www.gnu.org/licenses/.
-*/
-
-using System;
-
-
-namespace VNLib.Plugins.Essentials.Oauth
-{
- /// <summary>
- /// Raised when the session cache space has been exhausted and cannot
- /// load the new session into cache.
- /// </summary>
- public class OauthSessionCacheExhaustedException : Exception
- {
- public OauthSessionCacheExhaustedException(string message) : base(message)
- {}
- public OauthSessionCacheExhaustedException(string message, Exception innerException) : base(message, innerException)
- {}
- public OauthSessionCacheExhaustedException()
- {}
- }
-} \ No newline at end of file