-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1245 from DuendeSoftware/joe/initiate-login-uri
Add support for initiate_login_uri
- Loading branch information
Showing
19 changed files
with
147 additions
and
11 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
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,40 @@ | ||
using Duende.IdentityServer.EntityFramework.DbContexts; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace IdentityServerHost.Pages.Portal; | ||
|
||
public class ThirdPartyInitiatedLoginLink | ||
{ | ||
public string LinkText { get; set; } | ||
public string InitiateLoginUri { get; set; } | ||
} | ||
|
||
|
||
public class ClientRepository | ||
{ | ||
private readonly ConfigurationDbContext _context; | ||
|
||
public ClientRepository(ConfigurationDbContext context) | ||
{ | ||
_context = context; | ||
} | ||
|
||
public async Task<IEnumerable<ThirdPartyInitiatedLoginLink>> GetClientsWithLoginUris(string filter = null) | ||
{ | ||
var query = _context.Clients | ||
.Where(c => c.InitiateLoginUri != null); | ||
|
||
if (!String.IsNullOrWhiteSpace(filter)) | ||
{ | ||
query = query.Where(x => x.ClientId.Contains(filter) || x.ClientName.Contains(filter)); | ||
} | ||
|
||
var result = query.Select(c => new ThirdPartyInitiatedLoginLink | ||
{ | ||
LinkText = string.IsNullOrWhiteSpace(c.ClientName) ? c.ClientId : c.ClientName, | ||
InitiateLoginUri = c.InitiateLoginUri | ||
}); | ||
|
||
return await result.ToArrayAsync(); | ||
} | ||
} |
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,30 @@ | ||
@page | ||
@model IdentityServerHost.Pages.Portal.Index | ||
|
||
<div class="portal-page"> | ||
|
||
<div class="lead"> | ||
<h1>Client Application Portal</h1> | ||
<p>This portal contains links to client applications that are configured | ||
with an InitiateLoginUri, which enables | ||
<a href="https://openid.net/specs/openid-connect-core-1_0.html#ThirdPartyInitiatedLogin">third-party initiated login</a>. | ||
</p> | ||
</div> | ||
|
||
@if(!Model.Clients.Any()) | ||
{ | ||
<div class="alert"> | ||
You do not have any clients configured with an InitiateLoginUri. | ||
</div> | ||
} | ||
|
||
<ul class="list-group"> | ||
@foreach (var client in Model.Clients) | ||
{ | ||
<li class="list-group-item"> | ||
<a href="@client.InitiateLoginUri">@client.LinkText</a> | ||
</li> | ||
} | ||
</ul> | ||
|
||
</div> |
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 @@ | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace IdentityServerHost.Pages.Portal; | ||
|
||
public class Index : PageModel | ||
{ | ||
private readonly ClientRepository _repository; | ||
public IEnumerable<ThirdPartyInitiatedLoginLink> Clients { get; private set; } | ||
|
||
public Index(ClientRepository repository) | ||
{ | ||
_repository = repository; | ||
} | ||
|
||
public async Task OnGetAsync() | ||
{ | ||
Clients = await _repository.GetClientsWithLoginUris(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"ConnectionStrings": { | ||
"db": "server=localhost;database=Duende.EntityFramework-6.3.0;trusted_connection=yes;" | ||
// "db": "server=(localdb)\\mssqllocaldb;database=Duende.EntityFramework-6.1.0;trusted_connection=yes;" | ||
// "db": "server=(localdb)\\mssqllocaldb;database=Duende.EntityFramework-6.3.0;trusted_connection=yes;" | ||
} | ||
} |
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
15 changes: 14 additions & 1 deletion
15
.../20220324152912_Configuration.Designer.cs → .../20230410170353_Configuration.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...GrantDb/20220324152905_Grants.Designer.cs → ...GrantDb/20230410170347_Grants.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"ConnectionStrings": { | ||
"db": "server=(localdb)\\mssqllocaldb;database=Duende.EntityFramework-6.1.0;trusted_connection=yes;" | ||
//"db": "Data Source=DuendeIdentityServer.db;" | ||
"db": "server=localhost;database=Duende.EntityFramework-6.3.0;trusted_connection=yes;" | ||
// "db": "server=(localdb)\\mssqllocaldb;database=Duende.EntityFramework-6.3.0;trusted_connection=yes;" | ||
} | ||
} |
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
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