Skip to content

Commit

Permalink
Merge pull request #44 from linianhui/upgrade-package
Browse files Browse the repository at this point in the history
Upgrade package
  • Loading branch information
linianhui authored May 22, 2021
2 parents c70eb38 + 76050df commit c9db42c
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 23 deletions.
34 changes: 29 additions & 5 deletions 1-src/web.oauth2.client.aspnetcore/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -8,8 +8,8 @@
<header>
<nav>
@if (this.User != null
&& this.User.Identity != null
&& this.User.Identity.IsAuthenticated == true)
&& this.User.Identity != null
&& this.User.Identity.IsAuthenticated == true)
{
@Html.RouteLink("Logout", "account-logout")
}
Expand All @@ -19,11 +19,35 @@
<br />
@Html.RouteLink("Login (QQ Mobile)", "account-login", new { idp = "qq", returnUri = this.Context.Request.Path.Value, isMobile = true })
<br />
@Html.RouteLink("Login (Github)", "account-login", new { idp = "github", returnUri = this.Context.Request.Path.Value})
@Html.RouteLink("Login (Github)", "account-login", new { idp = "github", returnUri = this.Context.Request.Path.Value })
}
</nav>
</header>
<br />
@RenderBody()
<footer>
@{ var OSArchitecture = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture.ToString();
var OSDescription = System.Runtime.InteropServices.RuntimeInformation.OSDescription;
var ProcessArchitecture = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString();
var FrameworkDescription = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; }
<br />
<table>
<tr>
<td colspan="2">Runtime Info</td>
</tr>
<tr>
<td>OS</td>
<td>@OSDescription @OSArchitecture</td>
</tr>
<tr>
<td>CPU</td>
<td>@ProcessArchitecture</td>
</tr>
<tr>
<td>Framework</td>
<td>@FrameworkDescription</td>
</tr>
</table>
</footer>
</body>
</html>
</html>
33 changes: 29 additions & 4 deletions 1-src/web.oidc.client.hybrid/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@using Microsoft.AspNetCore.Http.Extensions
@using Microsoft.AspNetCore.Http.Extensions
<!DOCTYPE html>
<html>
<head>
Expand All @@ -9,8 +9,8 @@
<header>
<nav>
@if (this.User != null
&& this.User.Identity != null
&& this.User.Identity.IsAuthenticated == true)
&& this.User.Identity != null
&& this.User.Identity.IsAuthenticated == true)
{
@Html.RouteLink("Logout", "account-logout")
}
Expand All @@ -26,5 +26,30 @@
</header>
<br />
@RenderBody()

<footer>
@{ var OSArchitecture = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture.ToString();
var OSDescription = System.Runtime.InteropServices.RuntimeInformation.OSDescription;
var ProcessArchitecture = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString();
var FrameworkDescription = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; }
<br />
<table>
<tr>
<td colspan="2">Runtime Info</td>
</tr>
<tr>
<td>OS</td>
<td>@OSDescription @OSArchitecture</td>
</tr>
<tr>
<td>CPU</td>
<td>@ProcessArchitecture</td>
</tr>
<tr>
<td>Framework</td>
<td>@FrameworkDescription</td>
</tr>
</table>
</footer>
</body>
</html>
</html>
27 changes: 26 additions & 1 deletion 1-src/web.oidc.server.ids4/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -8,5 +8,30 @@
<div>
@RenderBody()
</div>
<footer>
@{
var OSArchitecture = System.Runtime.InteropServices.RuntimeInformation.OSArchitecture.ToString();
var OSDescription = System.Runtime.InteropServices.RuntimeInformation.OSDescription;
var ProcessArchitecture = System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture.ToString();
var FrameworkDescription = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; }
<br/>
<table>
<tr>
<td colspan="2">Runtime Info</td>
</tr>
<tr>
<td>OS</td>
<td>@OSDescription @OSArchitecture</td>
</tr>
<tr>
<td>CPU</td>
<td>@ProcessArchitecture</td>
</tr>
<tr>
<td>Framework</td>
<td>@FrameworkDescription</td>
</tr>
</table>
</footer>
</body>
</html>
2 changes: 1 addition & 1 deletion 1-src/web.oidc.server.ids4/web.oidc.server.ids4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="IdentityServer4" Version="4.1.1" />
<PackageReference Include="IdentityServer4" Version="4.1.2" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions 1-src/wpf.oidc.client.authorization-code/Main.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Windows;
using Newtonsoft.Json;
using WPFClient.Models;
using WPFClient.Oidc;

Expand Down Expand Up @@ -44,11 +43,13 @@ private TokenModel GetTokenModel()
return new TokenModel();
}

var json= token.RootElement;

return new TokenModel
{
Token = token.ToString(Formatting.Indented),
IdToken = JwtModel.From(token.Value<string>("id_token")),
AccessToken = JwtModel.From(token.Value<string>("access_token")),
Token = json.ToString(),
IdToken = JwtModel.From(json.GetProperty("id_token").GetString()),
AccessToken = JwtModel.From(json.GetProperty("access_token").GetString()),
};
}
}
Expand Down
7 changes: 5 additions & 2 deletions 1-src/wpf.oidc.client.authorization-code/Models/JwtModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Newtonsoft.Json;
using System.IdentityModel.Tokens.Jwt;
using System.Text.Json;

namespace WPFClient.Models
{
Expand All @@ -13,7 +13,10 @@ public class JwtModel

public override string ToString()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
return JsonSerializer.Serialize(this, new JsonSerializerOptions
{
WriteIndented = true
});
}

public static JwtModel From(string jwtString)
Expand Down
6 changes: 3 additions & 3 deletions 1-src/wpf.oidc.client.authorization-code/Oidc/TokenFile.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Text.Json;

namespace WPFClient.Oidc
{
public static class TokenFile
{
private static string TokenFilePath => Environment.CurrentDirectory + "/token.json";

public static JObject Read()
public static JsonDocument Read()
{
if (File.Exists(TokenFilePath))
{
return JObject.Parse(File.ReadAllText(TokenFilePath));
return JsonDocument.Parse(File.ReadAllText(TokenFilePath));
}

return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
Expand All @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.7.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.1" />
<PackageReference Include="System.Text.Json" Version="5.0.2" />
</ItemGroup>

</Project>

0 comments on commit c9db42c

Please sign in to comment.