public async Task Expand(Claims claims, string cids)
		{
			var realm = await claims.Get(KnownIdentities.Realm, resolve: false);
			var uid = await claims.Get(KnownIdentities.Uid, resolve: false);
			Contract.Assert(!string.IsNullOrWhiteSpace(realm), "claims error -- invalid realm");
			Contract.Assert(!string.IsNullOrWhiteSpace(uid), "claims error -- invalid uid");
			var path = string.Format("/{0}/claims-ticket/{1}/expand?cids={2}", realm, uid, cids);
			var res = await this.Client.GetAsync(path);
			Contract.Assert(res.IsSuccessStatusCode, string.Format("claims error -- failed to expand: '{0} ({1})'", (int)res.StatusCode, res.ReasonPhrase));
			var parsed = await res.Content.ReadAsAsync<Claims>();
			claims.Merge(parsed);
		}
Exemple #2
0
		internal void Merge(Claims parsed)
		{
			foreach (var from in parsed.Claimsets)
			{
				Claimset claimset;
				if (!this.Claimsets.TryGetValue(from.Key, out claimset))
				{
					claimset = from.Value;
				}
				else
				{
					claimset.Merge(from.Value);
				}
			}
		}