public void GetPasswordToken() { IClientConfiguration clientConfiguration = this.clientFixture.GetClientConfiguration("TokenClientWithSmallerScope"); InMemoryUserCredentialsStoreManager userCredentialsStoreManager = new InMemoryUserCredentialsStoreManager(); userCredentialsStoreManager.Username = "******"; userCredentialsStoreManager.Password = "******"; ITokenProvider tokenProvider = new PasswordTokenProvider( this.clientFixture.GetService <IHttpClientFactory>(), clientConfiguration, userCredentialsStoreManager, this.clientFixture.GetService <ISerializerService>()); Token token = tokenProvider.Token; Assert.NotNull(token.AccessToken); }
public void RefreshTokenPasswordFlow() { IClientConfiguration clientConfiguration = this.clientFixture.GetClientConfiguration("TokenClientWithSmallerScope"); InMemoryUserCredentialsStoreManager userCredentialsStoreManager = new InMemoryUserCredentialsStoreManager(); userCredentialsStoreManager.Username = "******"; userCredentialsStoreManager.Password = "******"; ITokenProvider tokenProvider = new PasswordTokenProvider( this.clientFixture.GetService <IHttpClientFactory>(), clientConfiguration, userCredentialsStoreManager, this.clientFixture.GetService <ISerializerService>()); Token token = tokenProvider.Token; string initialAccessToken = token.AccessToken; // TODO Find a better way to test this (with mock objects perhaps) token.ExpiresIn = 0; token = tokenProvider.Token; Assert.NotEqual(token.AccessToken, initialAccessToken); }