示例#1
0
        public async Task GetToken_SucessfullyAsync()
        {
            // Arrange
            var auth   = new ClientCredentialsAuthentication(Configuration.ClientCredentials.ClientId, Configuration.ClientCredentials.ClientSecret);
            var config = new DokladConfiguration(Configuration.Urls.ApiUrl, Configuration.Urls.IdentityServerTokenUrl);

            auth.Configuration = config;

            // Act
            var token = await auth.GetTokenAsync();

            // Assert
            Assert.IsNotNull(token);
            Assert.That(token.AccessToken, Is.Not.Null.Or.Empty);
        }
示例#2
0
        public async Task Claims_ParsedSucessfullyAsync()
        {
            // Arrange
            var auth   = new ClientCredentialsAuthentication(Configuration.ClientCredentials.ClientId, Configuration.ClientCredentials.ClientSecret);
            var config = new DokladConfiguration(Configuration.Urls.ApiUrl, Configuration.Urls.IdentityServerTokenUrl);

            auth.Configuration = config;

            // Act
            var token = await auth.GetTokenAsync();

            // Assert
            Assert.IsNotNull(token);
            Assert.That(token.Claims, Is.Not.Null.And.Not.Empty);
            var tokenClaims = new TokenClaims(token.Claims);

            Assert.That(tokenClaims.LicenceStatus, Is.Not.Null);
            Assert.That(tokenClaims.UserRight, Is.Not.Null);
        }