Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zoom implementation of AspNet.Security.OAuth #836

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions AspNet.Security.OAuth.Providers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{C2CA4B38-A
docs\workweixin.md = docs\workweixin.md
docs\xumm.md = docs\xumm.md
docs\zendesk.md = docs\zendesk.md
docs\zoom.md = docs\zoom.md
softwareolatomiwa marked this conversation as resolved.
Show resolved Hide resolved
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Basecamp", "src\AspNet.Security.OAuth.Basecamp\AspNet.Security.OAuth.Basecamp.csproj", "{42306484-B2BF-4B52-B950-E0CDFA58B02A}"
Expand Down Expand Up @@ -296,6 +297,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.PingO
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.JumpCloud", "src\AspNet.Security.OAuth.JumpCloud\AspNet.Security.OAuth.JumpCloud.csproj", "{8AF5DDBE-2631-4E71-9045-73A6356CE86B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AspNet.Security.OAuth.Zoom", "src\AspNet.Security.OAuth.Zoom\AspNet.Security.OAuth.Zoom.csproj", "{A4DFC94C-0769-41B3-926C-22642185C878}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -678,6 +681,10 @@ Global
{8AF5DDBE-2631-4E71-9045-73A6356CE86B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AF5DDBE-2631-4E71-9045-73A6356CE86B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8AF5DDBE-2631-4E71-9045-73A6356CE86B}.Release|Any CPU.Build.0 = Release|Any CPU
{A4DFC94C-0769-41B3-926C-22642185C878}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4DFC94C-0769-41B3-926C-22642185C878}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4DFC94C-0769-41B3-926C-22642185C878}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4DFC94C-0769-41B3-926C-22642185C878}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -783,6 +790,7 @@ Global
{101681FB-569F-4941-B943-2AD380039BE0} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
{CF8C4235-6AE6-404E-B572-4FF4E85AB5FF} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
{8AF5DDBE-2631-4E71-9045-73A6356CE86B} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
{A4DFC94C-0769-41B3-926C-22642185C878} = {C1352FD3-AE8B-43EE-B45B-F6E0B3FBAC6D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C7B54DE2-6407-4802-AD9C-CE54BF414C8C}
Expand Down
16 changes: 16 additions & 0 deletions docs/zoom.md
martincostello marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Integrating the Zoom Provider

## Example

```csharp
services.AddAuthentication(options => /* Auth configuration */)
.AddZoom(options =>
{
options.ClientId = "my-client-id";
options.ClientSecret = "my-client-secret";
});
```

## Required Additional Settings

_None._
18 changes: 18 additions & 0 deletions src/AspNet.Security.OAuth.Zoom/AspNet.Security.OAuth.Zoom.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
</PropertyGroup>

martincostello marked this conversation as resolved.
Show resolved Hide resolved
<PropertyGroup>
<Description>ASP.NET Core security middleware enabling Zoom authentication.</Description>
<Authors>Christian Oluwawibe</Authors>
<PackageTags>aspnetcore;authentication;zoom;oauth;security</PackageTags>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
</ItemGroup>

</Project>
94 changes: 94 additions & 0 deletions src/AspNet.Security.OAuth.Zoom/ZoomAuthenticationConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* 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.Zoom;

/// <summary>
/// Contains constants specific to the <see cref="ZoomAuthenticationHandler"/>.
/// </summary>
public static class ZoomAuthenticationConstants
{
public static class Claims
{
public const string Picture = "picture";

public const string Email = "email";

public const string NameIdentifier = "id";

public const string Name = "name";

public const string GivenName = "given_name";

public const string FamilyName = "family_name";

public const string PhoneNumber = "phone_number";

public const string Status = "account_status";

public const string Verified = "verified";

public const string PersonalMeetingUrl = "personal_meeting_url";
}

/// <summary>
/// Available profile fields after a Zoom authentication.
/// See <a>https://developers.zoom.us/docs/api/rest/reference/user/methods/#operation/user</a>
/// </summary>
public static class ProfileFields
{
/// <summary>
/// The unique identifier for the given memembermber. May also be referenced as the <c>personId</c> within a Person URN (<c>urn:li:person:{personId}</c>).
/// The <c>id</c> is unique to your specific developer application. Any attempts to use the <c>id</c> with other developer applications will not succeed.
martincostello marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public const string Id = "id";

/// <summary>
/// Display name of the user.
/// </summary>
public const string Name = "display_name";

/// <summary>
/// Given/First name of the user.
/// </summary>
public const string GivenName = "first_name";

/// <summary>
/// Last name of the user.
/// </summary>
public const string FamilyName = "last_name";

/// <summary>
/// Email address of the user.
/// </summary>
public const string Email = "email";

/// <summary>
/// Phone number of the user.
/// </summary>
public const string PhoneNumber = "phone_number";

/// <summary>
/// Picture url of the user.
martincostello marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public const string PictureUrl = "pic_url";

/// <summary>
/// AccountStatus of the user.
/// </summary>
public const string Status = "status";

/// <summary>
/// Verification status of the user.
/// </summary>
public const string Verified = "verified";

/// <summary>
/// Personal meeting url of the user.
martincostello marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
public const string PersonalMeetingUrl = "personal_meeting_url";
}
}
48 changes: 48 additions & 0 deletions src/AspNet.Security.OAuth.Zoom/ZoomAuthenticationDefaults.cs
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.Zoom;

/// <summary>
/// Default values used by the Zoom authentication middleware.
/// </summary>
public class ZoomAuthenticationDefaults
{
/// <summary>
/// Default value for <see cref="AuthenticationScheme.Name"/>.
/// </summary>
public const string AuthenticationScheme = "Zoom";

/// <summary>
/// Default value for <see cref="AuthenticationScheme.DisplayName"/>.
/// </summary>
public static readonly string DisplayName = "Zoom";

/// <summary>
/// Default value for <see cref="AuthenticationSchemeOptions.ClaimsIssuer"/>.
/// </summary>
public static readonly string Issuer = "Zoom";

/// <summary>
/// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>.
/// </summary>
public static readonly string CallbackPath = "/signin-zoom";

/// <summary>
/// Default value for <see cref="OAuthOptions.AuthorizationEndpoint"/>.
/// </summary>
public static readonly string AuthorizationEndpoint = "https://zoom.us/oauth/authorize";

/// <summary>
/// Default value for <see cref="OAuthOptions.TokenEndpoint"/>.
/// </summary>
public static readonly string TokenEndpoint = "https://zoom.us/oauth/token";

/// <summary>
/// Default value for <see cref="OAuthOptions.UserInformationEndpoint"/>.
/// </summary>
public static readonly string UserInformationEndpoint = "https://zoom.us/v2/users/me";
martincostello marked this conversation as resolved.
Show resolved Hide resolved
}
74 changes: 74 additions & 0 deletions src/AspNet.Security.OAuth.Zoom/ZoomAuthenticationExtensions.cs
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.Zoom;

namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Extension methods to add Zoom authentication capabilities to an HTTP application pipeline.
/// </summary>
public static class ZoomAuthenticationExtensions
{
/// <summary>
/// Adds <see cref="ZoomAuthenticationHandler"/> to the specified
/// <see cref="AuthenticationBuilder"/>, which enables Zoom authentication capabilities.
/// </summary>
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to add the middleware to.</param>
/// <returns>A reference to this instance after the operation has completed.</returns>
public static AuthenticationBuilder AddZoom([NotNull] this AuthenticationBuilder builder)
{
return builder.AddZoom(ZoomAuthenticationDefaults.AuthenticationScheme, options => { });
}

/// <summary>
/// Adds <see cref="ZoomAuthenticationHandler"/> to the specified
/// <see cref="AuthenticationBuilder"/>, which enables Zoom authentication capabilities.
/// </summary>
/// <param name="builder">The <see cref="AuthenticationBuilder"/> to add the middleware to.</param>
/// <param name="configuration">The delegate used to configure the OpenID 2.0 options.</param>
/// <returns>A reference to this instance after the operation has completed.</returns>
public static AuthenticationBuilder AddZoom(
[NotNull] this AuthenticationBuilder builder,
[NotNull] Action<ZoomAuthenticationOptions> configuration)
{
return builder.AddZoom(ZoomAuthenticationDefaults.AuthenticationScheme, configuration);
}

/// <summary>
/// Adds <see cref="ZoomAuthenticationHandler"/> to the specified
/// <see cref="AuthenticationBuilder"/>, which enables Zoom 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 Zoom options.</param>
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
public static AuthenticationBuilder AddZoom(
[NotNull] this AuthenticationBuilder builder,
[NotNull] string scheme,
[NotNull] Action<ZoomAuthenticationOptions> configuration)
{
return builder.AddZoom(scheme, ZoomAuthenticationDefaults.DisplayName, configuration);
}

/// <summary>
/// Adds <see cref="ZoomAuthenticationHandler"/> to the specified
/// <see cref="AuthenticationBuilder"/>, which enables Zoom 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 Zoom options.</param>
/// <returns>The <see cref="AuthenticationBuilder"/>.</returns>
public static AuthenticationBuilder AddZoom(
[NotNull] this AuthenticationBuilder builder,
[NotNull] string scheme,
[CanBeNull] string caption,
[NotNull] Action<ZoomAuthenticationOptions> configuration)
{
return builder.AddOAuth<ZoomAuthenticationOptions, ZoomAuthenticationHandler>(scheme, caption, configuration);
}
}
Loading
Loading