Skip to content

Commit eaacfab

Browse files
committed
chore: setup client with angular 8
1 parent b60d03a commit eaacfab

File tree

227 files changed

+38177
-40918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+38177
-40918
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
################################################################################
44

55
/Solution 1 - Setup OIDC system with client credentials/ResourceApi/obj/Debug/netcoreapp2.0
6+
/Solution 6 - OIDC and Angular client/.vs/oidc-angular-identityserver
7+
/Solution 6 - OIDC and Angular client/AngularClientCode
8+
/Solution 6 - OIDC and Angular client/StsServerIdentity
9+
/Solution 6 - OIDC and Angular client/ResourceServer
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
bin
2-
obj
1+
bin/
2+
obj/

Solution 6 - OIDC and Angular client/AuthorizationServer/Config.cs

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public static IEnumerable<IdentityResource> GetIdentityResources()
2727
};
2828
}
2929

30+
private static string spaClientUrl = "https://localhost:53709";
31+
3032
public static IEnumerable<Client> GetClients()
3133
{
3234
return new List<Client>
@@ -60,8 +62,8 @@ public static IEnumerable<Client> GetClients()
6062
new Secret("secret".Sha256())
6163
},
6264

63-
RedirectUris = { "https://localhost:44311/signin-oidc" },
64-
PostLogoutRedirectUris = { "https://localhost:44311/signout-callback-oidc" },
65+
RedirectUris = { $"{spaClientUrl}/signin-oidc" },
66+
PostLogoutRedirectUris = { $"{spaClientUrl}/signout-callback-oidc" },
6567
AllowedScopes =
6668
{
6769
IdentityServerConstants.StandardScopes.OpenId,
@@ -77,16 +79,56 @@ public static IEnumerable<Client> GetClients()
7779
AllowedGrantTypes = GrantTypes.Implicit,
7880
AllowAccessTokensViaBrowser = true,
7981

80-
RedirectUris = { "https://localhost:44311/callback" },
81-
PostLogoutRedirectUris = { "https://localhost:44311/" },
82-
AllowedCorsOrigins = { "https://localhost:44311" },
82+
RedirectUris = { $"{spaClientUrl}/callback" },
83+
PostLogoutRedirectUris = { $"{spaClientUrl}/" },
84+
AllowedCorsOrigins = { $"{spaClientUrl}" },
8385
AllowedScopes =
8486
{
8587
IdentityServerConstants.StandardScopes.OpenId,
8688
IdentityServerConstants.StandardScopes.Profile,
8789
"resourceApi"
8890
}
89-
}
91+
},
92+
new Client
93+
{
94+
ClientId = "spaCodeClient",
95+
ClientName = "SPA Code Client",
96+
AccessTokenType = AccessTokenType.Reference,
97+
// RequireConsent = false,
98+
AccessTokenLifetime = 330,// 330 seconds, default 60 minutes
99+
IdentityTokenLifetime = 30,
100+
101+
RequireClientSecret = false,
102+
AllowedGrantTypes = GrantTypes.Code,
103+
RequirePkce = true,
104+
105+
AllowAccessTokensViaBrowser = true,
106+
RedirectUris = new List<string>
107+
{
108+
$"{spaClientUrl}",
109+
$"{spaClientUrl}/silent-renew.html",
110+
"https://localhost:4200",
111+
"https://localhost:4200/silent-renew.html"
112+
},
113+
PostLogoutRedirectUris = new List<string>
114+
{
115+
$"{spaClientUrl}/unauthorized",
116+
$"{spaClientUrl}",
117+
"https://localhost:4200/unauthorized",
118+
"https://localhost:4200"
119+
},
120+
AllowedCorsOrigins = new List<string>
121+
{
122+
$"{spaClientUrl}",
123+
"https://localhost:4200"
124+
},
125+
AllowedScopes = new List<string>
126+
{
127+
IdentityServerConstants.StandardScopes.OpenId,
128+
IdentityServerConstants.StandardScopes.Profile,
129+
"resourceApi"
130+
}
131+
},
90132
};
91133
}
92134

0 commit comments

Comments
 (0)