Esempio n. 1
0
        public virtual async Task <IHttpActionResult> Refresh()
        {
            Identity identity = this.GetIdentity();

            if (identity == null || identity.Client.IsBlocked)
            {
                return(this.Unauthorized());
            }

            if (!JwtTokenizer.IsValid(
                    identity.User.Credential.ApiKey.Key,
                    identity.Client.ApiKey.Key,
                    identity.Refresh))
            {
                return(this.Unauthorized());
            }

            this.GetToken(identity);

            this._repository.Update(identity);
            await this._repository.CommitAsync();

            return(this.Ok(new TokenResponse {
                Access = identity.Access, Refresh = identity.Refresh
            }));
        }
Esempio n. 2
0
 public bool ValidIdentity(Identity identity)
 {
     return(JwtTokenizer.IsValid(identity.User.Credential.ApiKey.Key, identity.Client.ApiKey.Key, identity.Access));
 }