Esempio n. 1
0
        public void GetAnonymousTokenNoIdProvided()
        {
            IClientConfiguration clientConfiguration = this.clientFixture.GetClientConfiguration("TokenClientWithAnonymousScope");
            IAnonymousCredentialsStoreManager anonymousStoreManager = new InMemoryAnonymousCredentialsStoreManager();
            ITokenProvider tokenProvider = new AnonymousSessionTokenProvider(
                this.clientFixture.GetService <IHttpClientFactory>(),
                clientConfiguration,
                anonymousStoreManager,
                this.clientFixture.GetService <ISerializerService>());
            Token token = tokenProvider.Token;

            Assert.NotNull(token.AccessToken);
        }
        public void GetAnonymousTokenIdProvided()
        {
            IClientConfiguration clientConfiguration = this.clientFixture.GetClientConfiguration("TokenClientWithAnonymousScope");
            InMemoryAnonymousCredentialsStoreManager anonymousStoreManager = new InMemoryAnonymousCredentialsStoreManager();

            anonymousStoreManager.AnonymousId = TestingUtility.RandomString(10);
            ITokenProvider tokenProvider = new AnonymousSessionTokenProvider(
                this.provider.GetService <IHttpClientFactory>(),
                anonymousStoreManager,
                this.clientFixture.GetService <ISerializerService>());

            tokenProvider.ClientConfiguration = clientConfiguration;
            Token token = tokenProvider.Token;

            Assert.NotNull(token.AccessToken);
        }