コード例 #1
0
    public void ExtractClaimsFromDictionary(Dictionary <string, string> headerDictionary)
    {
        #region ExtractClaimsFromDictionary

        var claimsList = ClaimsAppender.Extract(headerDictionary, "prefix.");

        #endregion
    }
    public Task Append()
    {
        var headers = new Dictionary <string, string>();
        var claims  = BuildClaims();

        ClaimsAppender.Append(claims, headers, "prefix.");
        return(Verify(headers));
    }
コード例 #3
0
    public void AppendClaimsToDictionary(Dictionary <string, string> headerDictionary)
    {
        #region AppendClaimsToDictionary

        var claims = new List <Claim>
        {
            new(ClaimTypes.Email, "*****@*****.**"),
            new(ClaimTypes.NameIdentifier, "User1"),
            new(ClaimTypes.NameIdentifier, "User2")
        };
        ClaimsAppender.Append(claims, headerDictionary, "prefix.");

        #endregion
    }
    public Task Extract()
    {
        var headers = new Dictionary <string, string>();
        var claims  = BuildClaims();

        ClaimsAppender.Append(claims, headers, "prefix.");
        var result = ClaimsAppender.Extract(headers, "prefix.")
                     .Select(x => new
        {
            x.Type,
            x.Value
        });

        return(Verify(result));
    }
コード例 #5
0
    void ProcessClaims(HttpContext context, PassthroughMessage passThroughMessage)
    {
        if (!appendClaims)
        {
            return;
        }

        var user = context.User;

        if (user?.Claims == null)
        {
            return;
        }

        if (!user.Claims.Any())
        {
            return;
        }

        ClaimsAppender.Append(user.Claims, passThroughMessage.ExtraHeaders, claimsHeaderPrefix);
    }