public async Task <bool> ValidateClient(string clientId, string clientSecret)
        {
            string dict_clientSecret;

            if (dictClient.TryGetValue(clientId, out dict_clientSecret) && dict_clientSecret == clientSecret)
            {
                return(true);
            }
            else
            {
                return(await Task.Run <bool>(() => {
                    AuthClientInfoEntity entity = new AuthClientInfoEntity();
                    entity.ClientId = clientId;
                    entity.ClientSecret = clientSecret;
                    OQL q = OQL.From(entity)
                            .Select(entity.ClientId)
                            .Where(entity.ClientId, entity.ClientSecret)
                            .END;
                    AuthDbContext context = new AuthDbContext();
                    AuthClientInfoEntity dbEntity = context.QueryObject <AuthClientInfoEntity>(q);
                    if (dbEntity != null)
                    {
                        dictClient.TryAdd(clientId, clientSecret);
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }));
            }
        }
示例#2
0
        public async Task <bool> ValidateClient(string clientId, string clientSecret)
        {
            AuthClientInfoEntity entity = new AuthClientInfoEntity();

            entity.ClientId     = clientId;
            entity.ClientSecret = clientSecret;
            OQL q = OQL.From(entity)
                    .Select(entity.ClientId)
                    .Where(entity.ClientId, entity.ClientSecret)
                    .END;
            AuthDbContext        context  = new AuthDbContext();
            AuthClientInfoEntity dbEntity = context.QueryObject <AuthClientInfoEntity>(q);

            return(dbEntity != null);
        }
示例#3
0
        public async Task <bool> ValidatedUserPassword(string userName, string password)
        {
            UserInfoEntity user = new UserInfoEntity();

            user.UserName = userName;
            user.Password = password;
            OQL q = OQL.From(user)
                    .Select()
                    .Where(user.UserName, user.Password)
                    .END;
            AuthDbContext        context  = new AuthDbContext();
            AuthClientInfoEntity dbEntity = context.QueryObject <AuthClientInfoEntity>(q);

            return(dbEntity != null);
        }
示例#4
0
        public async Task <bool> ExistsClientId(string clientId)
        {
            AuthClientInfoEntity entity = new AuthClientInfoEntity();

            entity.ClientId = clientId;

            OQL q = OQL.From(entity)
                    .Select(entity.ClientId)
                    .Where(entity.ClientId)
                    .END;
            AuthDbContext        context  = new AuthDbContext();
            AuthClientInfoEntity dbEntity = context.QueryObject <AuthClientInfoEntity>(q);

            return(dbEntity != null);
        }