Tag: 声称

在C#中正确使用JwtTokens

我正在玩JwtTokens并且无法使它们正常工作。 我正在使用http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/ 。 我知道代码是一团糟,但只是为了表明我正在尝试做什么。 问题是我希望JwtTokenHandler因为生命周期而无法通过validation。 var key = “5A0AB091-3F84-4EC4-B227-0834FCD8B1B4”; var domain = “http://localhost”; var allowedAudience = “http://localhost”; var signatureAlgorithm = “http://www.w3.org/2001/04/xmldsig-more#hmac-sha256”; var digestAlgorithm = “http://www.w3.org/2001/04/xmlenc#sha256”; var issuer = “self”; var securityKey = System.Text.Encoding.Unicode.GetBytes(key); var inMemorySymmetricSecurityKey = new InMemorySymmetricSecurityKey(securityKey); var now = DateTime.UtcNow; var expiry = now.AddSeconds(1); var tokenHandler = new JwtSecurityTokenHandler(); var claimsList = new […]

WCF,Claims,ADFS 3.0

我正在尝试了解使用WCF,Claims和ADFS 3.0开发框架所需的内容。 内部用户将针对Active Directory进行身份validation,外部用户将针对SQL Server表进行身份validation,并且授权将存储在实现组和权限的数据库表中。 我正在使用WCF而不是Web Api或OWIN创建API。 我对使用Identity Server或第三方产品不感兴趣,我只是想知道如何创建自定义安全令牌服务以从我的成员资格表中读取并通过我的组和权限表设置声明。 我找不到任何关于此的信息。 Visual Studio 2015中没有Identity和Access控件,似乎没有使用WCF,仅使用Web Api,OWIN和MVC?

ASP.NET Core 2.0中缺少声明转换支持

我在我的新asp.net核心2.0 api应用程序中使用JWT Bearer auth并希望为当前身份添加一些额外声明。 这个额外的信息位于需要查询的另一个api中。 我的理解是,索赔转换将是适当的地方。 在.net核心1.1中,您在Microsoft.AspNetCore.Authentication nuget包中有IClaimsTransformer接口,但我无法在我的.net核心2.0应用程序中安装此接口。 是否有另一种方法来转换asp.net core 2.0中的声明,这是我的用例的正确方法吗?