Example #1
0
        public static void EnrichDomain(this JObject jObj, BaseClient result)
        {
            result.ClientId = jObj.GetClientId();
            result.TokenEndPointAuthMethod = jObj.GetTokenEndpointAuthMethod();
            result.GrantTypes      = jObj.GetGrantTypes();
            result.ResponseTypes   = jObj.GetResponseTypes();
            result.Contacts        = jObj.GetContacts();
            result.JwksUri         = jObj.GetJwksUri();
            result.JsonWebKeys     = jObj.GetJwks();
            result.SoftwareId      = jObj.GetSoftwareId();
            result.SoftwareVersion = jObj.GetSoftwareVersion();
            result.RedirectionUrls = jObj.GetRedirectUris();
            result.AllowedScopes   = jObj.GetScopes().Select(_ => new OAuthScope
            {
                Name = _
            }).ToList();
            result.TokenSignedResponseAlg    = jObj.GetTokenSignedResponseAlg();
            result.TokenEncryptedResponseAlg = jObj.GetTokenEncryptedResponseAlg();
            result.TokenEncryptedResponseEnc = jObj.GetTokenEncryptedResponseEnc();
            result.RegistrationAccessToken   = jObj.GetRegistrationAccessToken();
            result.TlsClientAuthSubjectDN    = jObj.GetTlsClientAuthSubjectDn();
            result.TlsClientAuthSanDNS       = jObj.GetTlsClientAuthSanDNS();
            result.TlsClientAuthSanURI       = jObj.GetTlsClientAuthSanUri();
            result.TlsClientAuthSanIP        = jObj.GetTlsClientAuthSanIP();
            result.TlsClientAuthSanEmail     = jObj.GetTlsClientAuthSanEmail();
            result.ClientSecret = jObj.GetClientSecret();
            var refreshTokenExpirationTimeInSeconds = jObj.GetRefreshTokenExpirationTimeInSeconds();
            var tokenExpirationTimeInSeconds        = jObj.GetTokenExpirationTimeInSeconds();

            if (refreshTokenExpirationTimeInSeconds != null)
            {
                result.RefreshTokenExpirationTimeInSeconds = refreshTokenExpirationTimeInSeconds.Value;
            }

            if (tokenExpirationTimeInSeconds != null)
            {
                result.TokenExpirationTimeInSeconds = tokenExpirationTimeInSeconds.Value;
            }

            var clientSecret = jObj.GetClientSecret();
            Dictionary <string, string> clientNames = jObj.GetClientNames(),
                                        clientUris  = jObj.GetClientUris(),
                                        logoUris    = jObj.GetLogoUris(),
                                        tosUris     = jObj.GetTosUris(),
                                        policyUris  = jObj.GetPolicyUris();

            foreach (var kvp in clientNames)
            {
                result.AddClientName(kvp.Key, kvp.Value);
            }

            foreach (var kvp in clientUris)
            {
                result.AddClientUri(kvp.Key, kvp.Value);
            }

            foreach (var kvp in logoUris)
            {
                result.AddLogoUri(kvp.Key, kvp.Value);
            }

            foreach (var kvp in tosUris)
            {
                result.AddTosUri(kvp.Key, kvp.Value);
            }

            foreach (var kvp in policyUris)
            {
                result.AddPolicyUri(kvp.Key, kvp.Value);
            }
        }