Beispiel #1
0
        public async Task TestAuthzApi()
        {
            var signerKey      = CryptoUtil.ReadRsaPublicKey(tokenSignerKey);
            var authzApiConfig = new AuthzApiConfig()
            {
                EndpointUri = authzUri,
                SignerKey   = signerKey
            };

            var client = new EntApiClient()
            {
                AuthzApiConfig = authzApiConfig,
                AccessToken    = accessToken
            };

            var authzApi   = client.AuthzApi;
            var computerId = "MyComputerId";

            authzApi.ComputerId = computerId;

            var authorizationDecision = await authzApi.CheckOrConsumeAsync("MyTestItem", false, ResponseType.JWT);

            Assert.That(authorizationDecision["iss"], Is.Not.Null.And.Not.Empty);
            Assert.That(authzApi.ComputerId, Is.EqualTo(computerId));
        }
Beispiel #2
0
        public async Task TestUserInfo()
        {
            var oauthConfig = new OAuthConfig()
            {
                UserInfoUri = userInfoUri
            };

            var client = new EntApiClient()
            {
                OAuthConfig = oauthConfig,
                AccessToken = accessToken
            };

            var userInfoData = await client.UserInfoApi.GetUserInfoAsync();

            Assert.That(userInfoData.sub, Is.Not.Null.And.Not.Empty);
        }