Example #1
0
		/// <summary>
		/// Gets the URL of the RP icon for the OP to display.
		/// </summary>
		/// <param name="realm">The realm of the RP where the authentication request originated.</param>
		/// <param name="hostFactories">The host factories.</param>
		/// <param name="cancellationToken">The cancellation token.</param>
		/// <returns>
		/// A sequence of the RP's icons it has available for the Provider to display, in decreasing preferred order.
		/// </returns>
		/// <value>The icon URL.</value>
		/// <remarks>
		/// This property is automatically set for the OP with the result of RP discovery.
		/// RPs should set this value by including an entry such as this in their XRDS document.
		/// <example>
		/// &lt;Service xmlns="xri://$xrd*($v*2.0)"&gt;
		/// &lt;Type&gt;http://specs.openid.net/extensions/ui/icon&lt;/Type&gt;
		/// &lt;URI&gt;http://consumer.example.com/images/image.jpg&lt;/URI&gt;
		/// &lt;/Service&gt;
		/// </example>
		/// </remarks>
		public static async Task<IEnumerable<Uri>> GetRelyingPartyIconUrlsAsync(Realm realm, IHostFactories hostFactories, CancellationToken cancellationToken) {
			Requires.NotNull(realm, "realm");
			Requires.NotNull(hostFactories, "hostFactories");

			XrdsDocument xrds = await realm.DiscoverAsync(hostFactories, false, cancellationToken);
			if (xrds == null) {
				return Enumerable.Empty<Uri>();
			} else {
				return xrds.FindRelyingPartyIcons();
			}
		}
Example #2
0
        /// <summary>
        /// Gets the URL of the RP icon for the OP to display.
        /// </summary>
        /// <param name="realm">The realm of the RP where the authentication request originated.</param>
        /// <param name="hostFactories">The host factories.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>
        /// A sequence of the RP's icons it has available for the Provider to display, in decreasing preferred order.
        /// </returns>
        /// <value>The icon URL.</value>
        /// <remarks>
        /// This property is automatically set for the OP with the result of RP discovery.
        /// RPs should set this value by including an entry such as this in their XRDS document.
        /// <example>
        /// &lt;Service xmlns="xri://$xrd*($v*2.0)"&gt;
        /// &lt;Type&gt;http://specs.openid.net/extensions/ui/icon&lt;/Type&gt;
        /// &lt;URI&gt;http://consumer.example.com/images/image.jpg&lt;/URI&gt;
        /// &lt;/Service&gt;
        /// </example>
        /// </remarks>
        public static async Task <IEnumerable <Uri> > GetRelyingPartyIconUrlsAsync(Realm realm, IHostFactories hostFactories, CancellationToken cancellationToken)
        {
            Requires.NotNull(realm, "realm");
            Requires.NotNull(hostFactories, "hostFactories");

            XrdsDocument xrds = await realm.DiscoverAsync(hostFactories, false, cancellationToken);

            if (xrds == null)
            {
                return(Enumerable.Empty <Uri>());
            }
            else
            {
                return(xrds.FindRelyingPartyIcons());
            }
        }