コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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));
 }
コード例 #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));
 }