Beispiel #1
0
    public static Dictionary <string, object> Decode(System.Web.HttpContext context, string secret = null)
    {
        String token = context.Authorization();

        if (token == null)
        {
            token = context.Request.QueryString.Get(".jwt");
        }
        if (token == null)
        {
            token = context.Request.Cookies.Get(".jwt")?.Value;
        }
        return(Jwt.Decode(token, secret));
    }
Beispiel #2
0
    public static Dictionary <string, object> Check(System.Web.HttpContext context,
                                                    string role, string secret = null)
    {
        String token = context.Authorization();

        if (token == null)
        {
            token = context.Request.QueryString.Get(".jwt");
        }
        if (token == null)
        {
            token = context.Request.Cookies.Get(".jwt")?.Value;
        }
        return(Jwt.Check(token, role, context.Request.UserHostAddress, secret));
    }