-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEndSessionRequest.cs
More file actions
29 lines (23 loc) · 948 Bytes
/
EndSessionRequest.cs
File metadata and controls
29 lines (23 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using System.Collections.Generic;
using IdentityModel.Client;
namespace OpenId.AspNet.Authentication
{
public class EndSessionRequest : AuthorizeRequest
{
public EndSessionRequest(Uri endSessionEndpoint) : base(endSessionEndpoint) {}
public EndSessionRequest(string endSessionEndpoint) : base(endSessionEndpoint) { }
public string CreateEndSessionUrl(string idToken, string redirectUri, string state = null)
{
var values = new Dictionary<string, string>();
if(!string.IsNullOrWhiteSpace(idToken))
values.Add("id_token_hint", idToken);
if(!string.IsNullOrWhiteSpace(redirectUri))
values.Add("post_logout_redirect_uri", redirectUri);
if(!string.IsNullOrWhiteSpace(state))
values.Add("state", state);
var result = this.Create(values);
return result;
}
}
}