/// <summary> /// Parses the operator urls from the parsed DiscoveryResponseData /// </summary> /// <param name="data">Data from the successful discovery response</param> /// <returns>Parsed operator urls or null if no urls found</returns> public static OperatorUrls Parse(DiscoveryResponseData data) { var links = data?.response?.apis?.operatorid?.link; if (links == null) { return(null); } var authorize = links.FirstOrDefault(x => x.rel == LinkRels.AUTHORIZATION).href; var token = links.FirstOrDefault(x => x.rel == LinkRels.TOKEN).href; return(new OperatorUrls() { AuthorizationUrl = authorize, RequestTokenUrl = token }); }
/// <summary> /// Parses the operator urls from the parsed DiscoveryResponseData /// </summary> /// <param name="data">Data from the successful discovery response</param> /// <returns>Parsed operator urls or null if no urls found</returns> public static OperatorUrls Parse(DiscoveryResponseData data) { var links = data?.response?.apis?.operatorid?.link; if (links == null) { return(null); } return(new OperatorUrls() { AuthorizationUrl = GetUrl(links, LinkRels.AUTHORIZATION), RequestTokenUrl = GetUrl(links, LinkRels.TOKEN), UserInfoUrl = GetUrl(links, LinkRels.USERINFO), PremiumInfoUrl = GetUrl(links, LinkRels.PREMIUMINFO), JWKSUrl = GetUrl(links, LinkRels.JWKS), RefreshTokenUrl = GetUrl(links, LinkRels.TOKENREFRESH), RevokeTokenUrl = GetUrl(links, LinkRels.TOKENREVOKE), ProviderMetadataUrl = GetUrl(links, LinkRels.OPENID_CONFIGURATION), ScopeUrl = GetUrl(links, LinkRels.SCOPE) }); }
/// <summary> /// /// </summary> /// <param name="clientSecret">Client secret</param> /// <param name="clientId">Client id</param> /// <param name="subId">Subscriber id</param> /// <param name="appName">Client application name</param> /// <param name="links">List of links</param> /// <param name="rel">List of rels</param> public DiscoveryResponseGenerateOptions(string clientSecret, string clientId, string subId, string appName, List <string> links, List <string> rel) { ClientSecret = clientSecret; ClientId = clientId; SubscriptionId = subId; ClientApplicationName = appName; LinkList = links; Rel = rel; Response = new DiscoveryResponseData() { response = new Response() { apis = new Apis() { operatorid = new Operatorid() { link = new List <Link>() } } }, subscriber_id = SubscriptionId }; Response.response.client_id = ClientId; Response.response.client_secret = ClientSecret; Response.response.client_name = ClientApplicationName; var listOfLinks = LinkList; var listOfRels = Rel; for (var i = 0; i < listOfLinks.Count; i++) { Response.response.apis.operatorid.link.Add(new Link() { href = listOfLinks[i], rel = listOfRels[i] }); } }
void OnServerFound(IPEndPoint sender, DiscoveryResponseData response) { discoveredServers[sender.Address] = response; }