-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5484c55
commit 75ebd13
Showing
15 changed files
with
1,091 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
src/AspNet.Security.OAuth.SuperOffice/AspNet.Security.OAuth.SuperOffice.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,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp3.1</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<Description>ASP.NET Core security middleware enabling SuperOffice authentication.</Description> | ||
<Authors>Anthony Yates</Authors> | ||
<PackageTags>superoffice;aspnetcore;authentication;oauth;security</PackageTags> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<FrameworkReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" /> | ||
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" /> | ||
</ItemGroup> | ||
|
||
</Project> |
271 changes: 271 additions & 0 deletions
271
src/AspNet.Security.OAuth.SuperOffice/SuperOfficeAuthenticationConstants.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,271 @@ | ||
/* | ||
* 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 Microsoft.AspNetCore.Authentication; | ||
|
||
namespace AspNet.Security.OAuth.SuperOffice | ||
{ | ||
/// <summary> | ||
/// Contains constants specific to the <see cref="SuperOfficeAuthenticationHandler"/>. | ||
/// </summary> | ||
public static class SuperOfficeAuthenticationConstants | ||
{ | ||
public static class ClaimNames | ||
{ | ||
/// <summary> | ||
/// Tenant's user identity. | ||
/// </summary> | ||
public const string AssociateId = "http://schemes.superoffice.net/identity/associateid"; | ||
|
||
/// <summary> | ||
/// Current user's company name. | ||
/// </summary> | ||
public const string CompanyName = "http://schemes.superoffice.net/identity/company_name"; | ||
|
||
/// <summary> | ||
/// Current user tenant identifier. | ||
/// </summary> | ||
public const string ContextIdentifier = "http://schemes.superoffice.net/identity/ctx"; | ||
|
||
/// <summary> | ||
/// Current SuperId user email address. | ||
/// </summary> | ||
public const string Email = "http://schemes.superoffice.net/identity/email"; | ||
|
||
/// <summary> | ||
/// Current user first name. | ||
/// </summary> | ||
public const string FirstName = "http://schemes.superoffice.net/identity/firstname"; | ||
|
||
/// <summary> | ||
/// SuperOffice identity provider name. | ||
/// </summary> | ||
public const string IdentityProvider = "http://schemes.superoffice.net/identity/identityprovider"; | ||
|
||
/// <summary> | ||
/// Current user initials. | ||
/// </summary> | ||
public const string Initials = "http://schemes.superoffice.net/identity/initials"; | ||
|
||
/// <summary> | ||
/// Determines if current user is an administrator. | ||
/// </summary> | ||
public const string IsAdministrator = "http://schemes.superoffice.net/identity/is_administrator"; | ||
|
||
/// <summary> | ||
/// Current user last name. | ||
/// </summary> | ||
public const string LastName = "http://schemes.superoffice.net/identity/lastname"; | ||
|
||
/// <summary> | ||
/// Endpoint of SuperOffice SOAP web services. | ||
/// </summary> | ||
public const string NetServerUrl = "http://schemes.superoffice.net/identity/netserver_url"; | ||
|
||
/// <summary> | ||
/// Tenant database serial number. | ||
/// </summary> | ||
public const string Serial = "http://schemes.superoffice.net/identity/serial"; | ||
|
||
/// <summary> | ||
/// Current user's tenant primary email address. | ||
/// </summary> | ||
public const string PrimaryEmail = "http://schemes.superoffice.net/identity/so_primary_email_address"; | ||
|
||
/// <summary> | ||
/// Identifier used to exchange for a system user ticket. | ||
/// </summary> | ||
public const string SystemToken = "http://schemes.superoffice.net/identity/system_token"; | ||
|
||
/// <summary> | ||
/// Credentials token used to access web services. | ||
/// </summary> | ||
public const string Ticket = "http://schemes.superoffice.net/identity/ticket"; | ||
|
||
/// <summary> | ||
/// Current user's username. | ||
/// </summary> | ||
public const string UserPrincipalName = "http://schemes.superoffice.net/identity/upn"; | ||
|
||
/// <summary> | ||
/// Endpoint of SuperOffice REST web services. | ||
/// </summary> | ||
public const string WebApiUrl = "http://schemes.superoffice.net/identity/webapi_url"; | ||
} | ||
|
||
internal static class FormatStrings | ||
{ | ||
/// <summary> | ||
/// A format string used to construct <see cref="SuperOfficeAuthenticationOptions.Authority"/>. | ||
/// </summary> | ||
public const string Authority = "https://{0}.superoffice.com/login"; | ||
|
||
/// <summary> | ||
/// A format string used to populate OAuth authorize endpoint. | ||
/// </summary> | ||
public const string AuthorizeEndpoint = "https://{0}.superoffice.com/login/common/oauth/authorize"; | ||
|
||
/// <summary> | ||
/// A format string used to construct <see cref="AuthenticationSchemeOptions.ClaimsIssuer"/>. | ||
/// </summary> | ||
public const string ClaimsIssuer = "https://{0}.superoffice.com"; | ||
|
||
/// <summary> | ||
/// A format string used to construct well-known configuration endpoint. | ||
/// </summary> | ||
public const string MetadataEndpoint = "https://{0}.superoffice.com/login/.well-known/openid-configuration"; | ||
|
||
/// <summary> | ||
/// A format string used to populate OAuth token endpoint. | ||
/// </summary> | ||
public const string TokenEndpoint = "https://{0}.superoffice.com/login/common/oauth/tokens"; | ||
|
||
/// <summary> | ||
/// A format string used to obtain user claims. | ||
/// </summary> | ||
/// <remarks>The final user information URL contains the protocol, host and tenant.</remarks> | ||
/// <example>https://sod.superoffice.com/Cust12345/api/v1/user/currentPrincipal</example> | ||
public const string UserInfoEndpoint = "/{0}/api/v1/user/currentPrincipal"; | ||
} | ||
|
||
public static class PrincipalNames | ||
{ | ||
/// <summary> | ||
/// Associate name (e.g. logon name) for the current user. | ||
/// </summary> | ||
public const string Associate = "Associate"; | ||
|
||
/// <summary> | ||
/// Associate ID for the current user. | ||
/// </summary> | ||
public const string AssociateId = "AssociateId"; | ||
|
||
/// <summary> | ||
/// Business ID for the company that the user belongs to. | ||
/// </summary> | ||
public const string BusinessId = "BusinessId"; | ||
|
||
/// <summary> | ||
/// Category ID of the company that the user belongs to. | ||
/// </summary> | ||
public const string CategoryId = "CategoryId"; | ||
|
||
/// <summary> | ||
/// Company of the associate's person. | ||
/// </summary> | ||
public const string ContactId = "ContactId"; | ||
|
||
/// <summary> | ||
/// Owner (AssociateId) of the company that the user belongs to. | ||
/// </summary> | ||
public const string ContactOwner = "ContactOwner"; | ||
|
||
/// <summary> | ||
/// Name of the tenant context identifier. | ||
/// </summary> | ||
public const string ContextIdentifier = "ContextIdentifier"; | ||
|
||
/// <summary> | ||
/// Country ID for the user. | ||
/// </summary> | ||
public const string CountryId = "CountryId"; | ||
|
||
/// <summary> | ||
/// Name of the database context. | ||
/// </summary> | ||
public const string DatabaseContextIdentifier = "DatabaseContextIdentifier"; | ||
|
||
/// <summary> | ||
/// Service user access level. | ||
/// </summary> | ||
public const string EjAccessLevel = "EjAccessLevel"; | ||
|
||
/// <summary> | ||
/// Primary key in Service user table. | ||
/// </summary> | ||
public const string EjUserId = "EjUserId"; | ||
|
||
/// <summary> | ||
/// Service user status. | ||
/// </summary> | ||
public const string EjUserStatus = "EjUserStatus"; | ||
|
||
/// <summary> | ||
/// The Person e-mail address if the associate is a person. Use IsPerson to check. | ||
/// </summary> | ||
public const string EmailAddress = "EMailAddress"; | ||
|
||
/// <summary> | ||
/// The Person full name if the associate is a person. Use IsPerson to check. | ||
/// </summary> | ||
public const string FullName = "FullName"; | ||
|
||
/// <summary> | ||
/// Functional rights for the user. This array is sorted. | ||
/// </summary> | ||
public const string FunctionRights = "FunctionRights"; | ||
|
||
/// <summary> | ||
/// Associate's group ID. | ||
/// </summary> | ||
public const string GroupId = "GroupId"; | ||
|
||
/// <summary> | ||
/// Country ID for the user's home country. This is the default country ID when creating new items. | ||
/// </summary> | ||
public const string HomeCountryId = "HomeCountryId"; | ||
|
||
/// <summary> | ||
/// Is this associate a person, and not a resource? | ||
/// </summary> | ||
public const string IsPerson = "IsPerson"; | ||
|
||
/// <summary> | ||
/// Licenses granted to the site and user. | ||
/// </summary> | ||
public const string Licenses = "Licenses"; | ||
|
||
/// <summary> | ||
/// Associate's person ID. | ||
/// </summary> | ||
public const string PersonId = "PersonId"; | ||
|
||
/// <summary> | ||
/// The credentials used for authenticating this user. | ||
/// </summary> | ||
public const string ProvidedCredentials = "ProvidedCredentials"; | ||
|
||
/// <summary> | ||
/// Description (e.g. tooltip) for the user's role. | ||
/// </summary> | ||
public const string RoleDescription = "RoleDescription"; | ||
|
||
/// <summary> | ||
/// ID of the user's role. | ||
/// </summary> | ||
public const string RoleId = "RoleId"; | ||
|
||
/// <summary> | ||
/// Name of the user's role. | ||
/// </summary> | ||
public const string RoleName = "RoleName"; | ||
|
||
/// <summary> | ||
/// Type of user. | ||
/// </summary> | ||
public const string RoleType = "RoleType"; | ||
|
||
/// <summary> | ||
/// Secondary user groups. | ||
/// </summary> | ||
public const string SecondaryGroups = "SecondaryGroups"; | ||
|
||
/// <summary> | ||
/// Type of user. | ||
/// </summary> | ||
public const string UserType = "UserType"; | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/AspNet.Security.OAuth.SuperOffice/SuperOfficeAuthenticationDefaults.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,31 @@ | ||
/* | ||
* 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 Microsoft.AspNetCore.Authentication; | ||
|
||
namespace AspNet.Security.OAuth.SuperOffice | ||
{ | ||
/// <summary> | ||
/// Default values used by the SuperOffice authentication middleware. | ||
/// </summary> | ||
public static class SuperOfficeAuthenticationDefaults | ||
{ | ||
/// <summary> | ||
/// Default value for <see cref="AuthenticationScheme.Name"/>. | ||
/// </summary> | ||
public const string AuthenticationScheme = "SuperOffice"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="RemoteAuthenticationOptions.CallbackPath"/>. | ||
/// </summary> | ||
public const string CallbackPath = "/signin-superoffice"; | ||
|
||
/// <summary> | ||
/// Default value for <see cref="AuthenticationScheme.DisplayName"/>. | ||
/// </summary> | ||
public static readonly string DisplayName = "SuperOffice"; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/AspNet.Security.OAuth.SuperOffice/SuperOfficeAuthenticationEnvironment.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.SuperOffice | ||
{ | ||
/// <summary> | ||
/// Used to map usage to specific online environment, i.e. development, stage or production. | ||
/// </summary> | ||
public enum SuperOfficeAuthenticationEnvironment | ||
{ | ||
Development, | ||
Stage, | ||
Production | ||
} | ||
} |
Oops, something went wrong.