Exemplo n.º 1
0
        public T InsertToken <T>(string AccessToken, OAuth2.DataModels.TokenTypes TokenType, long ExpiresIn, long IssuedTime, string ClientID, string Scope = "", string ResourceOwnerID = "", string RefreshToken = null) where T : OAuth2.DataModels.Token, new()
        {
            if (CacheTokenModel == null && DBTokenModel == null)
            {
                return(null);
            }

            T val = null;

            if (CacheTokenModel != null)
            {
                val = CacheTokenModel.InsertToken <T>(AccessToken, TokenType, ExpiresIn, IssuedTime, ClientID, Scope, ResourceOwnerID, RefreshToken);
            }
            if (DBTokenModel != null)
            {
                val = DBTokenModel.InsertToken <T>(AccessToken, TokenType, ExpiresIn, IssuedTime, ClientID, Scope, ResourceOwnerID, RefreshToken);
            }
            return(val);
        }
Exemplo n.º 2
0
        public T InsertToken <T>(string AccessToken, OAuth2.DataModels.TokenTypes TokenType, long ExpiresIn, long IssuedTime, OAuth2.DataModels.Client Client, IEnumerable <OAuth2.DataModels.Scope> Scope, OAuth2.DataModels.ResourceOwner ResourceOwner = null, string RefreshToken = null) where T : OAuth2.DataModels.Token, new()
        {
            if (CacheTokenModel == null && DBTokenModel == null)
            {
                return(null);
            }

            T val = null;

            if (CacheTokenModel != null)
            {
                val = CacheTokenModel.InsertToken <T>(AccessToken, TokenType, ExpiresIn, IssuedTime, Client, Scope, ResourceOwner, RefreshToken);
            }
            if (DBTokenModel != null)
            {
                val = DBTokenModel.InsertToken <T>(AccessToken, TokenType, ExpiresIn, IssuedTime, Client, Scope, ResourceOwner, RefreshToken);
            }
            return(val);
        }
Exemplo n.º 3
0
        public T InsertToken <T>(string AccessToken, OAuth2.DataModels.TokenTypes TokenType, long ExpiresIn, long IssuedTime, string ClientID, string Scope = "", string ResourceOwnerID = "", string RefreshToken = null)
            where T : OAuth2.DataModels.Token, new()
        {
            var token = new T()
            {
                access_token      = AccessToken,
                client_id         = ClientID,
                expires_in        = ExpiresIn,
                issue_time        = IssuedTime,
                refresh_token     = RefreshToken,
                resource_owner_id = ResourceOwnerID,
                scope             = Scope,
                token_type        = TokenType,
            };

            if (InsertToken(token))
            {
                return(token);
            }

            return(null);
        }
Exemplo n.º 4
0
 public T InsertToken <T>(string AccessToken, OAuth2.DataModels.TokenTypes TokenType, long ExpiresIn, long IssuedTime, OAuth2.DataModels.Client Client, IEnumerable <OAuth2.DataModels.Scope> Scope, OAuth2.DataModels.ResourceOwner ResourceOwner = null, string RefreshToken = null)
     where T : OAuth2.DataModels.Token, new()
 {
     return(InsertToken <T>(AccessToken, TokenType, ExpiresIn, IssuedTime, Client, Scope.ToScopeString(), ResourceOwner, RefreshToken));
 }
Exemplo n.º 5
0
 public T InsertToken <T>(string AccessToken, OAuth2.DataModels.TokenTypes TokenType, long ExpiresIn, long IssuedTime, OAuth2.DataModels.Client Client, string Scope = "", OAuth2.DataModels.ResourceOwner ResourceOwner = null, string RefreshToken = null)
     where T : OAuth2.DataModels.Token, new()
 {
     return(InsertToken <T>(AccessToken, TokenType, ExpiresIn, IssuedTime, Client.id, Scope, ResourceOwner == null ? "" : ResourceOwner.id, RefreshToken));
 }