Exemplo n.º 1
0
        public bool InsertToken(OAuth2.DataModels.Token Token)
        {
            if (CacheTokenModel == null && DBTokenModel == null)
            {
                return(false);
            }

            if (CacheTokenModel != null && !CacheTokenModel.InsertToken(Token))
            {
                return(false);
            }

            if (DBTokenModel != null && !DBTokenModel.InsertToken(Token))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
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.º 3
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);
        }