Skip to content

Commit

Permalink
Convert top level usings in made code base.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhiggins732 committed Feb 14, 2024
1 parent ba7e242 commit ca681f4
Show file tree
Hide file tree
Showing 598 changed files with 41,392 additions and 41,987 deletions.
21 changes: 10 additions & 11 deletions src/AspNetIdentity/host/Configuration/Clients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ copies or substantial portions of the Software.
using IdentityServer8.Models;
using System.Collections.Generic;

namespace IdentityServerHost.Configuration
namespace IdentityServerHost.Configuration;

public static class Clients
{
public static class Clients
public static IEnumerable<Client> Get()
{
public static IEnumerable<Client> Get()
{
var clients = new List<Client>();

clients.AddRange(ClientsConsole.Get());
clients.AddRange(ClientsWeb.Get());

return clients;
}
var clients = new List<Client>();

clients.AddRange(ClientsConsole.Get());
clients.AddRange(ClientsWeb.Get());

return clients;
}
}
363 changes: 181 additions & 182 deletions src/AspNetIdentity/host/Configuration/ClientsConsole.cs

Large diffs are not rendered by default.

197 changes: 98 additions & 99 deletions src/AspNetIdentity/host/Configuration/ClientsWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,128 +17,127 @@ copies or substantial portions of the Software.
using IdentityServer8;
using IdentityServer8.Models;

namespace IdentityServerHost.Configuration
namespace IdentityServerHost.Configuration;

public static class ClientsWeb
{
public static class ClientsWeb
static string[] allowedScopes =
{
static string[] allowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"resource1.scope1",
"resource2.scope1",
"transaction"
};
public static IEnumerable<Client> Get()
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"resource1.scope1",
"resource2.scope1",
"transaction"
};

public static IEnumerable<Client> Get()
{
return new List<Client>
{
return new List<Client>
///////////////////////////////////////////
// JS OIDC Sample
//////////////////////////////////////////
new Client
{
///////////////////////////////////////////
// JS OIDC Sample
//////////////////////////////////////////
new Client
ClientId = "js_oidc",
ClientName = "JavaScript OIDC Client",
ClientUri = "http://identityserver8.io",

AllowedGrantTypes = GrantTypes.Code,
RequireClientSecret = false,

RedirectUris =
{
ClientId = "js_oidc",
ClientName = "JavaScript OIDC Client",
ClientUri = "http://identityserver8.io",

AllowedGrantTypes = GrantTypes.Code,
RequireClientSecret = false,

RedirectUris =
{
"https://localhost:44300/index.html",
"https://localhost:44300/callback.html",
"https://localhost:44300/silent.html",
"https://localhost:44300/popup.html"
},

PostLogoutRedirectUris = { "https://localhost:44300/index.html" },
AllowedCorsOrigins = { "https://localhost:44300" },

AllowedScopes = allowedScopes
"https://localhost:44300/index.html",
"https://localhost:44300/callback.html",
"https://localhost:44300/silent.html",
"https://localhost:44300/popup.html"
},

PostLogoutRedirectUris = { "https://localhost:44300/index.html" },
AllowedCorsOrigins = { "https://localhost:44300" },

AllowedScopes = allowedScopes
},

///////////////////////////////////////////
// MVC Automatic Token Management Sample
//////////////////////////////////////////
new Client
{
ClientId = "mvc.tokenmanagement",

///////////////////////////////////////////
// MVC Automatic Token Management Sample
//////////////////////////////////////////
new Client
ClientSecrets =
{
ClientId = "mvc.tokenmanagement",

ClientSecrets =
{
new Secret("secret".Sha256())
},
new Secret("secret".Sha256())
},

AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,
AllowedGrantTypes = GrantTypes.Code,
RequirePkce = true,

AccessTokenLifetime = 75,
AccessTokenLifetime = 75,

RedirectUris = { "https://localhost:44301/signin-oidc" },
FrontChannelLogoutUri = "https://localhost:44301/signout-oidc",
PostLogoutRedirectUris = { "https://localhost:44301/signout-callback-oidc" },
RedirectUris = { "https://localhost:44301/signin-oidc" },
FrontChannelLogoutUri = "https://localhost:44301/signout-oidc",
PostLogoutRedirectUris = { "https://localhost:44301/signout-callback-oidc" },

AllowOfflineAccess = true,
AllowOfflineAccess = true,

AllowedScopes = allowedScopes
},

///////////////////////////////////////////
// MVC Code Flow Sample
//////////////////////////////////////////
new Client
AllowedScopes = allowedScopes
},

///////////////////////////////////////////
// MVC Code Flow Sample
//////////////////////////////////////////
new Client
{
ClientId = "mvc.code",
ClientName = "MVC Code Flow",
ClientUri = "http://identityserver8.io",

ClientSecrets =
{
ClientId = "mvc.code",
ClientName = "MVC Code Flow",
ClientUri = "http://identityserver8.io",
new Secret("secret".Sha256())
},

ClientSecrets =
{
new Secret("secret".Sha256())
},
RequireConsent = true,
AllowedGrantTypes = GrantTypes.Code,

RequireConsent = true,
AllowedGrantTypes = GrantTypes.Code,
RedirectUris = { "https://localhost:44302/signin-oidc" },
FrontChannelLogoutUri = "https://localhost:44302/signout-oidc",
PostLogoutRedirectUris = { "https://localhost:44302/signout-callback-oidc" },

RedirectUris = { "https://localhost:44302/signin-oidc" },
FrontChannelLogoutUri = "https://localhost:44302/signout-oidc",
PostLogoutRedirectUris = { "https://localhost:44302/signout-callback-oidc" },
AllowOfflineAccess = true,

AllowOfflineAccess = true,
AllowedScopes = allowedScopes
},

///////////////////////////////////////////
// MVC Hybrid Flow Sample (Back Channel logout)
//////////////////////////////////////////
new Client
{
ClientId = "mvc.hybrid.backchannel",
ClientName = "MVC Hybrid (with BackChannel logout)",
ClientUri = "http://identityserver8.io",

AllowedScopes = allowedScopes
},

///////////////////////////////////////////
// MVC Hybrid Flow Sample (Back Channel logout)
//////////////////////////////////////////
new Client
ClientSecrets =
{
ClientId = "mvc.hybrid.backchannel",
ClientName = "MVC Hybrid (with BackChannel logout)",
ClientUri = "http://identityserver8.io",

ClientSecrets =
{
new Secret("secret".Sha256())
},
new Secret("secret".Sha256())
},

AllowedGrantTypes = GrantTypes.Hybrid,
RequirePkce = false,
AllowedGrantTypes = GrantTypes.Hybrid,
RequirePkce = false,

RedirectUris = { "https://localhost:44303/signin-oidc" },
BackChannelLogoutUri = "https://localhost:44303/logout",
PostLogoutRedirectUris = { "https://localhost:44303/signout-callback-oidc" },
RedirectUris = { "https://localhost:44303/signin-oidc" },
BackChannelLogoutUri = "https://localhost:44303/logout",
PostLogoutRedirectUris = { "https://localhost:44303/signout-callback-oidc" },

AllowOfflineAccess = true,
AllowOfflineAccess = true,

AllowedScopes = allowedScopes
}
};
}
AllowedScopes = allowedScopes
}
};
}
}
119 changes: 59 additions & 60 deletions src/AspNetIdentity/host/Configuration/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,75 +18,74 @@ copies or substantial portions of the Software.
using System.Collections.Generic;
using static IdentityServer8.IdentityServerConstants;

namespace IdentityServerHost.Configuration
namespace IdentityServerHost.Configuration;

public class Resources
{
public class Resources
{
// identity resources represent identity data about a user that can be requested via the scope parameter (OpenID Connect)
public static readonly IEnumerable<IdentityResource> IdentityResources =
new[]
{
// some standard scopes from the OIDC spec
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
new IdentityResources.Email(),
// identity resources represent identity data about a user that can be requested via the scope parameter (OpenID Connect)
public static readonly IEnumerable<IdentityResource> IdentityResources =
new[]
{
// some standard scopes from the OIDC spec
new IdentityResources.OpenId(),
new IdentityResources.Profile(),
new IdentityResources.Email(),

// custom identity resource with some consolidated claims
new IdentityResource("custom.profile", new[] { JwtClaimTypes.Name, JwtClaimTypes.Email, "location" })
};
// custom identity resource with some consolidated claims
new IdentityResource("custom.profile", new[] { JwtClaimTypes.Name, JwtClaimTypes.Email, "location" })
};

// API scopes represent values that describe scope of access and can be requested by the scope parameter (OAuth)
public static readonly IEnumerable<ApiScope> ApiScopes =
new[]
{
// local API scope
new ApiScope(LocalApi.ScopeName),
// API scopes represent values that describe scope of access and can be requested by the scope parameter (OAuth)
public static readonly IEnumerable<ApiScope> ApiScopes =
new[]
{
// local API scope
new ApiScope(LocalApi.ScopeName),

// resource specific scopes
new ApiScope("resource1.scope1"),
new ApiScope("resource2.scope1"),
// a scope without resource association
new ApiScope("scope3"),
// a scope shared by multiple resources
new ApiScope("shared.scope"),
// resource specific scopes
new ApiScope("resource1.scope1"),
new ApiScope("resource2.scope1"),

// a scope without resource association
new ApiScope("scope3"),

// a scope shared by multiple resources
new ApiScope("shared.scope"),

// a parameterized scope
new ApiScope("transaction", "Transaction")
{
Description = "Some Transaction"
}
};
// a parameterized scope
new ApiScope("transaction", "Transaction")
{
Description = "Some Transaction"
}
};

// API resources are more formal representation of a resource with processing rules and their scopes (if any)
public static readonly IEnumerable<ApiResource> ApiResources =
new[]
// API resources are more formal representation of a resource with processing rules and their scopes (if any)
public static readonly IEnumerable<ApiResource> ApiResources =
new[]
{
new ApiResource("resource1", "Resource 1")
{
new ApiResource("resource1", "Resource 1")
{
ApiSecrets = { new Secret("secret".Sha256()) },
ApiSecrets = { new Secret("secret".Sha256()) },

Scopes = { "resource1.scope1", "shared.scope" }
},

// expanded version if more control is needed
new ApiResource("resource2", "Resource 2")
Scopes = { "resource1.scope1", "shared.scope" }
},

// expanded version if more control is needed
new ApiResource("resource2", "Resource 2")
{
ApiSecrets =
{
ApiSecrets =
{
new Secret("secret".Sha256())
},
new Secret("secret".Sha256())
},

// additional claims to put into access token
UserClaims =
{
JwtClaimTypes.Name,
JwtClaimTypes.Email
},
// additional claims to put into access token
UserClaims =
{
JwtClaimTypes.Name,
JwtClaimTypes.Email
},

Scopes = { "resource2.scope1", "shared.scope" }
}
};
}
Scopes = { "resource2.scope1", "shared.scope" }
}
};
}
Loading

0 comments on commit ca681f4

Please sign in to comment.