-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
439 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Integrating the Smartsheet Provider | ||
|
||
## Example | ||
|
||
```csharp | ||
services.AddAuthentication(options => /* Auth configuration */) | ||
.AddSmartsheet(options => | ||
{ | ||
options.ClientId = "my-client-id"; | ||
options.ClientSecret = "my-client-secret"; | ||
|
||
// At least one scope must be passed | ||
options.Scope.Add("READ_SHEETS"); | ||
}); | ||
``` | ||
|
||
## Required Additional Settings | ||
|
||
_None._ | ||
|
||
## Optional Settings | ||
|
||
_None._ |
23 changes: 23 additions & 0 deletions
23
src/AspNet.Security.OAuth.Smartsheet/AspNet.Security.OAuth.Smartsheet.csproj
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,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks> | ||
<PackageValidationBaselineVersion>6.0.14</PackageValidationBaselineVersion> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Description>ASP.NET Core security middleware enabling Smartsheet authentication.</Description> | ||
<Authors>Steve Albison</Authors> | ||
<PackageTags>aspnetcore;authentication;oauth;smartsheet;security</PackageTags> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
</Project> |
18 changes: 18 additions & 0 deletions
18
src/AspNet.Security.OAuth.Smartsheet/SmartsheetAuthenticationConstants.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,18 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers | ||
* for more information concerning the license and the contributors participating to this project. | ||
*/ | ||
|
||
namespace AspNet.Security.OAuth.Smartsheet; | ||
|
||
/// <summary> | ||
/// Contains constants specific to the <see cref="SmartsheetAuthenticationHandler"/>. | ||
/// </summary> | ||
public static class SmartsheetAuthenticationConstants | ||
{ | ||
public static class Claims | ||
{ | ||
public const string ProfileImage = "urn:smartsheet:profileimage"; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/AspNet.Security.OAuth.Smartsheet/SmartsheetAuthenticationDefaults.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,48 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers | ||
* for more information concerning the license and the contributors participating to this project. | ||
*/ | ||
|
||
namespace AspNet.Security.OAuth.Smartsheet; | ||
|
||
/// <summary> | ||
/// Default values used by the Smartsheet authentication middleware. | ||
/// </summary> | ||
public static class SmartsheetAuthenticationDefaults | ||
{ | ||
/// <summary> | ||
/// Default value for <see cref="AuthenticationScheme.Name"/>. | ||
/// </summary> | ||
public const string AuthenticationScheme = "Smartsheet"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="AuthenticationScheme.DisplayName"/>. | ||
/// </summary> | ||
public static readonly string DisplayName = "Smartsheet"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="AuthenticationSchemeOptions.ClaimsIssuer"/>. | ||
/// </summary> | ||
public static readonly string Issuer = "Smartsheet"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>. | ||
/// </summary> | ||
public static readonly string CallbackPath = "/signin-smartsheet"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="OAuthOptions.AuthorizationEndpoint"/>. | ||
/// </summary> | ||
public static readonly string AuthorizationEndpoint = "https://app.smartsheet.com/b/authorize"; | ||
|
||
/// <summary> | ||
/// Format value for <see cref="OAuthOptions.TokenEndpoint"/>. | ||
/// </summary> | ||
public static readonly string TokenEndpoint = "https://api.smartsheet.com/2.0/token"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="OAuthOptions.UserInformationEndpoint"/>. | ||
/// </summary> | ||
public static readonly string UserInformationEndpoint = "https://api.smartsheet.com/2.0/users/me"; | ||
} |
74 changes: 74 additions & 0 deletions
74
src/AspNet.Security.OAuth.Smartsheet/SmartsheetAuthenticationExtensions.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,74 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) | ||
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers | ||
* for more information concerning the license and the contributors participating to this project. | ||
*/ | ||
|
||
using AspNet.Security.OAuth.Smartsheet; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
/// <summary> | ||
/// Extension methods to add Smartsheet authentication capabilities to an HTTP application pipeline. | ||
/// </summary> | ||
public static class SmartsheetAuthenticationExtensions | ||
{ | ||
/// <summary> | ||
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified | ||
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities. | ||
/// </summary> | ||
/// <param name="builder">The authentication builder.</param> | ||
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
public static AuthenticationBuilder AddSmartsheet([NotNull] this AuthenticationBuilder builder) | ||
{ | ||
return builder.AddSmartsheet(SmartsheetAuthenticationDefaults.AuthenticationScheme, options => { }); | ||
} | ||
|
||
/// <summary> | ||
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified | ||
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities. | ||
/// </summary> | ||
/// <param name="builder">The authentication builder.</param> | ||
/// <param name="configuration">The delegate used to configure the OpenID 2.0 options.</param> | ||
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
public static AuthenticationBuilder AddSmartsheet( | ||
[NotNull] this AuthenticationBuilder builder, | ||
[NotNull] Action<SmartsheetAuthenticationOptions> configuration) | ||
{ | ||
return builder.AddSmartsheet(SmartsheetAuthenticationDefaults.AuthenticationScheme, configuration); | ||
} | ||
|
||
/// <summary> | ||
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified | ||
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities. | ||
/// </summary> | ||
/// <param name="builder">The authentication builder.</param> | ||
/// <param name="scheme">The authentication scheme associated with this instance.</param> | ||
/// <param name="configuration">The delegate used to configure the Smartsheet options.</param> | ||
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
public static AuthenticationBuilder AddSmartsheet( | ||
[NotNull] this AuthenticationBuilder builder, | ||
[NotNull] string scheme, | ||
[NotNull] Action<SmartsheetAuthenticationOptions> configuration) | ||
{ | ||
return builder.AddSmartsheet(scheme, SmartsheetAuthenticationDefaults.DisplayName, configuration); | ||
} | ||
|
||
/// <summary> | ||
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified | ||
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities. | ||
/// </summary> | ||
/// <param name="builder">The authentication builder.</param> | ||
/// <param name="scheme">The authentication scheme associated with this instance.</param> | ||
/// <param name="caption">The optional display name associated with this instance.</param> | ||
/// <param name="configuration">The delegate used to configure the Smartsheet options.</param> | ||
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns> | ||
public static AuthenticationBuilder AddSmartsheet( | ||
[NotNull] this AuthenticationBuilder builder, | ||
[NotNull] string scheme, | ||
[CanBeNull] string caption, | ||
[NotNull] Action<SmartsheetAuthenticationOptions> configuration) | ||
{ | ||
return builder.AddOAuth<SmartsheetAuthenticationOptions, SmartsheetAuthenticationHandler>(scheme, caption, configuration); | ||
} | ||
} |
Oops, something went wrong.