This repository was archived by the owner on Dec 24, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed
Owin.Security.OAuth.Introspection
Owin.Security.OAuth.Validation Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
using System ;
8
8
using JetBrains . Annotations ;
9
+ using Microsoft . Extensions . Logging ;
9
10
using Owin . Security . OAuth . Introspection ;
10
11
11
12
namespace Owin
@@ -64,5 +65,33 @@ public static IAppBuilder UseOAuthIntrospection(
64
65
65
66
return app . Use < OAuthIntrospectionMiddleware > ( app . Properties , options ) ;
66
67
}
68
+
69
+ /// <summary>
70
+ /// Configures the OAuth2 introspection middleware to enable logging.
71
+ /// </summary>
72
+ /// <param name="options">The options used to configure the OAuth2 introspection middleware.</param>
73
+ /// <param name="configuration">The delegate used to configure the logger factory.</param>
74
+ /// <returns>The options used to configure the OAuth2 introspection middleware.</returns>
75
+ public static OAuthIntrospectionOptions UseLogging (
76
+ [ NotNull ] this OAuthIntrospectionOptions options ,
77
+ [ NotNull ] Action < ILoggerFactory > configuration )
78
+ {
79
+ if ( options == null )
80
+ {
81
+ throw new ArgumentNullException ( nameof ( options ) ) ;
82
+ }
83
+
84
+ if ( configuration == null )
85
+ {
86
+ throw new ArgumentNullException ( nameof ( configuration ) ) ;
87
+ }
88
+
89
+ var factory = new LoggerFactory ( ) ;
90
+ configuration ( factory ) ;
91
+
92
+ options . Logger = factory . CreateLogger < OAuthIntrospectionMiddleware > ( ) ;
93
+
94
+ return options ;
95
+ }
67
96
}
68
97
}
Original file line number Diff line number Diff line change 6
6
7
7
using System ;
8
8
using JetBrains . Annotations ;
9
+ using Microsoft . Extensions . Logging ;
9
10
using Owin . Security . OAuth . Validation ;
10
11
11
12
namespace Owin
@@ -79,5 +80,33 @@ public static IAppBuilder UseOAuthValidation(
79
80
80
81
return app . Use < OAuthValidationMiddleware > ( app . Properties , options ) ;
81
82
}
83
+
84
+ /// <summary>
85
+ /// Configures the OAuth2 validation middleware to enable logging.
86
+ /// </summary>
87
+ /// <param name="options">The options used to configure the OAuth2 validation middleware.</param>
88
+ /// <param name="configuration">The delegate used to configure the logger factory.</param>
89
+ /// <returns>The options used to configure the OAuth2 validation middleware.</returns>
90
+ public static OAuthValidationOptions UseLogging (
91
+ [ NotNull ] this OAuthValidationOptions options ,
92
+ [ NotNull ] Action < ILoggerFactory > configuration )
93
+ {
94
+ if ( options == null )
95
+ {
96
+ throw new ArgumentNullException ( nameof ( options ) ) ;
97
+ }
98
+
99
+ if ( configuration == null )
100
+ {
101
+ throw new ArgumentNullException ( nameof ( configuration ) ) ;
102
+ }
103
+
104
+ var factory = new LoggerFactory ( ) ;
105
+ configuration ( factory ) ;
106
+
107
+ options . Logger = factory . CreateLogger < OAuthValidationMiddleware > ( ) ;
108
+
109
+ return options ;
110
+ }
82
111
}
83
112
}
You can’t perform that action at this time.
0 commit comments