-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support AccountOptions configuration (#63)
- Loading branch information
Showing
6 changed files
with
53 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"AutomaticRedirectAfterSignOut": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Serilog; | ||
|
||
namespace OpenIdConnectServer.Helpers | ||
{ | ||
public class AccountOptionsHelper | ||
{ | ||
public static void ConfigureAccountOptions(string accountOptionsStr) | ||
{ | ||
var accountOptions = JsonConvert.DeserializeObject<JObject>(accountOptionsStr); | ||
var targetFields = typeof(IdentityServerHost.Quickstart.UI.AccountOptions).GetFields(); | ||
var jValueValueProp = typeof(JValue).GetProperty(nameof(JValue.Value)); | ||
Array.ForEach(targetFields, k => { | ||
if (accountOptions.ContainsKey(k.Name)) { | ||
var fieldJValue = accountOptions[k.Name] as JValue; | ||
var fieldValue = jValueValueProp.GetValue(fieldJValue); | ||
k.SetValue(null, fieldValue); | ||
} | ||
}); | ||
} | ||
} | ||
} |
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