Skip to content

Commit 4144056

Browse files
Add Smartsheet provider (#741)
Add Smartsheet provider.
1 parent c9da77a commit 4144056

12 files changed

+439
-0
lines changed

AspNet.Security.OAuth.Providers.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{C2CA4B38-A
209209
docs\reddit.md = docs\reddit.md
210210
docs\salesforce.md = docs\salesforce.md
211211
docs\sign-in-with-apple.md = docs\sign-in-with-apple.md
212+
docs\smartsheet.md = docs\smartsheet.md
212213
docs\snapchat.md = docs\snapchat.md
213214
docs\stackexchange.md = docs\stackexchange.md
214215
docs\superoffice.md = docs\superoffice.md
@@ -290,6 +291,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Kroge
290291
EndProject
291292
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Xumm", "src\AspNet.Security.OAuth.Xumm\AspNet.Security.OAuth.Xumm.csproj", "{8E42EF81-A630-4BDB-B642-3F20C863F9BE}"
292293
EndProject
294+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Smartsheet", "src\AspNet.Security.OAuth.Smartsheet\AspNet.Security.OAuth.Smartsheet.csproj", "{68862DC5-65B7-4517-B909-AB334F9FCF6E}"
295+
EndProject
293296
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Huawei", "src\AspNet.Security.OAuth.Huawei\AspNet.Security.OAuth.Huawei.csproj", "{E3CF7FFC-56A0-4033-87A9-BB3080CF030E}"
294297
EndProject
295298
Global
@@ -666,6 +669,10 @@ Global
666669
{8E42EF81-A630-4BDB-B642-3F20C863F9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
667670
{8E42EF81-A630-4BDB-B642-3F20C863F9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
668671
{8E42EF81-A630-4BDB-B642-3F20C863F9BE}.Release|Any CPU.Build.0 = Release|Any CPU
672+
{68862DC5-65B7-4517-B909-AB334F9FCF6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
673+
{68862DC5-65B7-4517-B909-AB334F9FCF6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
674+
{68862DC5-65B7-4517-B909-AB334F9FCF6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
675+
{68862DC5-65B7-4517-B909-AB334F9FCF6E}.Release|Any CPU.Build.0 = Release|Any CPU
669676
{E3CF7FFC-56A0-4033-87A9-BB3080CF030E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
670677
{E3CF7FFC-56A0-4033-87A9-BB3080CF030E}.Debug|Any CPU.Build.0 = Debug|Any CPU
671678
{E3CF7FFC-56A0-4033-87A9-BB3080CF030E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -773,6 +780,7 @@ Global
773780
{B8F9B052-84BF-436C-B22B-CEBD5EB1F8E3} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
774781
{8C7A98A6-5F61-492B-980D-0A9F5F9F5C73} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
775782
{8E42EF81-A630-4BDB-B642-3F20C863F9BE} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
783+
{68862DC5-65B7-4517-B909-AB334F9FCF6E} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
776784
{E3CF7FFC-56A0-4033-87A9-BB3080CF030E} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
777785
EndGlobalSection
778786
GlobalSection(ExtensibilityGlobals) = postSolution

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ If a provider you're looking for does not exist, consider making a PR to add one
187187
| ServiceChannel | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.ServiceChannel?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.ServiceChannel/ "Download AspNet.Security.OAuth.ServiceChannel from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.ServiceChannel?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.ServiceChannel "Download AspNet.Security.OAuth.ServiceChannel from MyGet.org") | [Documentation](https://developer.servicechannel.com/basics/general/authentication "ServiceChannel developer documentation") |
188188
| Shopify | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.Shopify?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.Shopify/ "Download AspNet.Security.OAuth.Shopify from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.Shopify?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.Shopify "Download AspNet.Security.OAuth.Shopify from MyGet.org") | [Documentation](https://help.shopify.com/en/api/getting-started/authentication/oauth "Shopify developer documentation") |
189189
| Slack | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.Slack?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.Slack/ "Download AspNet.Security.OAuth.Slack from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.Slack?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.Slack "Download AspNet.Security.OAuth.Slack from MyGet.org") | [Documentation](https://api.slack.com/docs/oauth "Slack developer documentation") |
190+
| Smartsheet | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.Smartsheet?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.Smartsheet/ "Download AspNet.Security.OAuth.Smartsheet from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.Smartsheet?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.Smartsheet "Download AspNet.Security.OAuth.Smartsheet from MyGet.org") | [Documentation](https://smartsheet.redoc.ly/ "Smartsheet developer documentation") |
190191
| Snapchat | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.Snapchat?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.Snapchat/ "Download AspNet.Security.OAuth.Snapchat from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.Snapchat?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.Snapchat "Download AspNet.Security.OAuth.Snapchat from MyGet.org") | [Documentation](https://marketingapi.snapchat.com/docs/#authentication "Snapchat developer documentation") |
191192
| SoundCloud | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.SoundCloud?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.SoundCloud/ "Download AspNet.Security.OAuth.SoundCloud from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.SoundCloud?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.SoundCloud "Download AspNet.Security.OAuth.SoundCloud from MyGet.org") | [Documentation](https://developers.soundcloud.com/docs#authentication "SoundCloud developer documentation") |
192193
| Spotify | [![NuGet](https://buildstats.info/nuget/AspNet.Security.OAuth.Spotify?includePreReleases=false)](https://www.nuget.org/packages/AspNet.Security.OAuth.Spotify/ "Download AspNet.Security.OAuth.Spotify from NuGet.org") | [![MyGet](https://buildstats.info/myget/aspnet-contrib/AspNet.Security.OAuth.Spotify?includePreReleases=true)](https://www.myget.org/feed/aspnet-contrib/package/nuget/AspNet.Security.OAuth.Spotify "Download AspNet.Security.OAuth.Spotify from MyGet.org") | [Documentation](https://developer.spotify.com/documentation/general/guides/authorization-guide/ "Spotify developer documentation") |

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ covered by the section above.
6464
| QQ | _Optional_ | [Documentation](qq.md "QQ provider documentation") |
6565
| Reddit | _Optional_ | [Documentation](reddit.md "Reddit provider documentation") |
6666
| Salesforce | _Optional_ | [Documentation](salesforce.md "Salesforce provider documentation") |
67+
| Smartsheet | _Optional_ | [Documentation](smartsheet.md "Smartsheet provider documentation") |
6768
| Snapchat | _Optional_ | [Documentation](snapchat.md "Snapchat provider documentation") |
6869
| StackExchange | _Optional_ | [Documentation](stackexchange.md "StackExchange provider documentation") |
6970
| SuperOffice | **Required** | [Documentation](superoffice.md "SuperOffice provider documentation") |

docs/smartsheet.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Integrating the Smartsheet Provider
2+
3+
## Example
4+
5+
```csharp
6+
services.AddAuthentication(options => /* Auth configuration */)
7+
.AddSmartsheet(options =>
8+
{
9+
options.ClientId = "my-client-id";
10+
options.ClientSecret = "my-client-secret";
11+
12+
// At least one scope must be passed
13+
options.Scope.Add("READ_SHEETS");
14+
});
15+
```
16+
17+
## Required Additional Settings
18+
19+
_None._
20+
21+
## Optional Settings
22+
23+
_None._
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
5+
<PackageValidationBaselineVersion>6.0.14</PackageValidationBaselineVersion>
6+
</PropertyGroup>
7+
8+
<PropertyGroup>
9+
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
10+
</PropertyGroup>
11+
12+
<PropertyGroup>
13+
<Description>ASP.NET Core security middleware enabling Smartsheet authentication.</Description>
14+
<Authors>Steve Albison</Authors>
15+
<PackageTags>aspnetcore;authentication;oauth;smartsheet;security</PackageTags>
16+
</PropertyGroup>
17+
18+
<ItemGroup>
19+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
20+
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
21+
</ItemGroup>
22+
23+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.Smartsheet;
8+
9+
/// <summary>
10+
/// Contains constants specific to the <see cref="SmartsheetAuthenticationHandler"/>.
11+
/// </summary>
12+
public static class SmartsheetAuthenticationConstants
13+
{
14+
public static class Claims
15+
{
16+
public const string ProfileImage = "urn:smartsheet:profileimage";
17+
}
18+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
namespace AspNet.Security.OAuth.Smartsheet;
8+
9+
/// <summary>
10+
/// Default values used by the Smartsheet authentication middleware.
11+
/// </summary>
12+
public static class SmartsheetAuthenticationDefaults
13+
{
14+
/// <summary>
15+
/// Default value for <see cref="AuthenticationScheme.Name"/>.
16+
/// </summary>
17+
public const string AuthenticationScheme = "Smartsheet";
18+
19+
/// <summary>
20+
/// Default value for <see cref="AuthenticationScheme.DisplayName"/>.
21+
/// </summary>
22+
public static readonly string DisplayName = "Smartsheet";
23+
24+
/// <summary>
25+
/// Default value for <see cref="AuthenticationSchemeOptions.ClaimsIssuer"/>.
26+
/// </summary>
27+
public static readonly string Issuer = "Smartsheet";
28+
29+
/// <summary>
30+
/// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>.
31+
/// </summary>
32+
public static readonly string CallbackPath = "/signin-smartsheet";
33+
34+
/// <summary>
35+
/// Default value for <see cref="OAuthOptions.AuthorizationEndpoint"/>.
36+
/// </summary>
37+
public static readonly string AuthorizationEndpoint = "https://app.smartsheet.com/b/authorize";
38+
39+
/// <summary>
40+
/// Format value for <see cref="OAuthOptions.TokenEndpoint"/>.
41+
/// </summary>
42+
public static readonly string TokenEndpoint = "https://api.smartsheet.com/2.0/token";
43+
44+
/// <summary>
45+
/// Default value for <see cref="OAuthOptions.UserInformationEndpoint"/>.
46+
/// </summary>
47+
public static readonly string UserInformationEndpoint = "https://api.smartsheet.com/2.0/users/me";
48+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
3+
* See https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
4+
* for more information concerning the license and the contributors participating to this project.
5+
*/
6+
7+
using AspNet.Security.OAuth.Smartsheet;
8+
9+
namespace Microsoft.Extensions.DependencyInjection;
10+
11+
/// <summary>
12+
/// Extension methods to add Smartsheet authentication capabilities to an HTTP application pipeline.
13+
/// </summary>
14+
public static class SmartsheetAuthenticationExtensions
15+
{
16+
/// <summary>
17+
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified
18+
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities.
19+
/// </summary>
20+
/// <param name="builder">The authentication builder.</param>
21+
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
22+
public static AuthenticationBuilder AddSmartsheet([NotNull] this AuthenticationBuilder builder)
23+
{
24+
return builder.AddSmartsheet(SmartsheetAuthenticationDefaults.AuthenticationScheme, options => { });
25+
}
26+
27+
/// <summary>
28+
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified
29+
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities.
30+
/// </summary>
31+
/// <param name="builder">The authentication builder.</param>
32+
/// <param name="configuration">The delegate used to configure the OpenID 2.0 options.</param>
33+
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
34+
public static AuthenticationBuilder AddSmartsheet(
35+
[NotNull] this AuthenticationBuilder builder,
36+
[NotNull] Action<SmartsheetAuthenticationOptions> configuration)
37+
{
38+
return builder.AddSmartsheet(SmartsheetAuthenticationDefaults.AuthenticationScheme, configuration);
39+
}
40+
41+
/// <summary>
42+
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified
43+
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities.
44+
/// </summary>
45+
/// <param name="builder">The authentication builder.</param>
46+
/// <param name="scheme">The authentication scheme associated with this instance.</param>
47+
/// <param name="configuration">The delegate used to configure the Smartsheet options.</param>
48+
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
49+
public static AuthenticationBuilder AddSmartsheet(
50+
[NotNull] this AuthenticationBuilder builder,
51+
[NotNull] string scheme,
52+
[NotNull] Action<SmartsheetAuthenticationOptions> configuration)
53+
{
54+
return builder.AddSmartsheet(scheme, SmartsheetAuthenticationDefaults.DisplayName, configuration);
55+
}
56+
57+
/// <summary>
58+
/// Adds <see cref="SmartsheetAuthenticationHandler"/> to the specified
59+
/// <see cref="AuthenticationBuilder"/>, which enables Smartsheet authentication capabilities.
60+
/// </summary>
61+
/// <param name="builder">The authentication builder.</param>
62+
/// <param name="scheme">The authentication scheme associated with this instance.</param>
63+
/// <param name="caption">The optional display name associated with this instance.</param>
64+
/// <param name="configuration">The delegate used to configure the Smartsheet options.</param>
65+
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
66+
public static AuthenticationBuilder AddSmartsheet(
67+
[NotNull] this AuthenticationBuilder builder,
68+
[NotNull] string scheme,
69+
[CanBeNull] string caption,
70+
[NotNull] Action<SmartsheetAuthenticationOptions> configuration)
71+
{
72+
return builder.AddOAuth<SmartsheetAuthenticationOptions, SmartsheetAuthenticationHandler>(scheme, caption, configuration);
73+
}
74+
}

0 commit comments

Comments
 (0)