-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #288 from microsoft/dev
reworked adapter authorization +resetdemo
- Loading branch information
Showing
95 changed files
with
2,098 additions
and
1,267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/TeamCloud.API/Auth/Schemes/AdapterAuthenticationDefaults.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Microsoft.AspNetCore.Authentication.Cookies; | ||
|
||
namespace TeamCloud.API.Auth.Schemes | ||
{ | ||
public static class AdapterAuthenticationDefaults | ||
{ | ||
public const string AuthenticationScheme = "Adapter"; | ||
|
||
public const string AuthenticationType = "Adapter"; | ||
|
||
public const string QueryParam = "ott"; | ||
|
||
public const string ClaimType = "ott"; | ||
|
||
public static readonly string CookiePrefix = CookieAuthenticationDefaults.CookiePrefix; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/TeamCloud.API/Auth/Schemes/AdapterAuthenticationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Authentication.Cookies; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
using Microsoft.Extensions.Options; | ||
using System; | ||
using System.Diagnostics; | ||
|
||
namespace TeamCloud.API.Auth.Schemes | ||
{ | ||
public static class AdapterAuthenticationExtensions | ||
{ | ||
public static AuthenticationBuilder AddAdapterAuthentication(this AuthenticationBuilder authenticationBuilder) | ||
{ | ||
authenticationBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<CookieAuthenticationOptions>, PostConfigureCookieAuthenticationOptions>()); | ||
|
||
return authenticationBuilder.AddScheme<CookieAuthenticationOptions, AdapterAuthenticationHandler>(AdapterAuthenticationDefaults.AuthenticationScheme, options => | ||
{ | ||
options.ExpireTimeSpan = TimeSpan.FromMinutes(5); | ||
options.SlidingExpiration = true; | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.