forked from dotnet/Kerberos.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKerberosController.cs
More file actions
32 lines (28 loc) · 808 Bytes
/
KerberosController.cs
File metadata and controls
32 lines (28 loc) · 808 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
30
31
32
using Newtonsoft.Json;
using System.Linq;
using System.Security.Claims;
using System.Web.Http;
namespace KerberosWebSample
{
public class KerberosController : ApiController
{
private static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
Formatting = Formatting.Indented
};
public IHttpActionResult Get()
{
var claimsIdentity = User.Identity as ClaimsIdentity;
var claims = claimsIdentity.Claims.Select(c => new { c.Value, c.Type });
return Json(
new
{
claimsIdentity.Name,
claimsIdentity.IsAuthenticated,
claims
},
Settings
);
}
}
}