public async Task I_d_like_to_have_all_my_entitlements_downloaded_by_using_public_access_type() { //given var service = new AuthorizationManager(); var context = Context.Create() .Credentials(InputData.Username, InputData.Password) .Url(InputData.Endpoint) .Realm(InputData.Realm) .OpenIdConnect() .Public(InputData.PublicClientId); //when var result = await service .AuthorizeAsync(context) .ConfigureAwait(false); //then Assert.IsTrue(result); Assert.AreEqual(service.PriviligiesAsListOfNames().Count, 1); Assert.AreEqual(service.PriviligiesAsListOfRoles().Count, 1); Assert.AreEqual(service.RealmPriviligiesAsListOfNames().Count, 2); Assert.AreEqual(service.RealmPriviligiesAsListOfRoles().Count, 2); Assert.NotNull(service.Token); }
public void I_d_like_to_have_all_my_entitlements_downloaded_by_using_bearer_only_access_type() { //given var service = new AuthorizationManager(); var context = Context.Create() .Credentials(InputData.Username, InputData.Password) .Url(InputData.Endpoint) .Realm(InputData.Realm) .OpenIdConnect() .BearerOnly(InputData.BearerOnlyClientId, InputData.BearerOnlyClientSecret); var ex = Assert.Throws <AggregateException>(() => { //when var result = service.AuthorizeAsync(context).Result; }); //then Assert.IsNotNull(ex); Assert.AreEqual(ex.InnerException.GetType(), typeof(NotImplementedException)); }