private static void HandleSecurity(HttpRequest request)
        {
            if (request.Parameters.ContainsKey("t"))
            {
                try
                {
                    string token = request.Parameters["t"];

                    request.Token     = token;
                    request.TokenData = tokenSysten.GetTokenData(token);
                    if (VerifyToken(request, token))
                    {
                        request.Authenticated = true;

                        Token tk = tokenSysten.GetToken(token);
                        request.AuthenticationLevel = GetTokenLevel(tk);
                        Settings.PrepareRequest(tk, request);
                    }
                    else
                    {
                        request.Response.ContentType = request.Server.DefaultResponseTypeMime;
                        request.Write(new APIWrap(new InvalidTokenException()), request.Server.DefaultResponseType);
                        request.Close();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }
Exemple #2
0
 private StateObject Status(StateObject sObject)
 {
     sObject.buffer = sObject.GetBytesData(tSystem.GetToken(new JwtPayload {
         { "Action", "BackFist" }, { "Body", "Pucnh him" }
     }));
     return(sObject);
 }