コード例 #1
0
        public OktaTokenServiceTests()
        {
            _oktaSettings = Options.Create(new OktaSettings
            {
                Authority     = "authority",
                Audience      = "audience",
                ClientId      = "clientId",
                ClientSecret  = "clientSecret",
                Domain        = "domain",
                IntrospectUrl = "http://www.example.com/",
                SdkToken      = "token"
            });

            _sut = new OktaTokenService(_oktaSettings);
        }
コード例 #2
0
        public async Task <IClient> GetAddendaClient(OktaSettings authSettings, string baseUri, string token = null)
        {
            try
            {
                if (token == null)
                {
                    var _authService = new OktaTokenService(authSettings);
                    token = await _authService.GetToken();

                    if (token == null)
                    {
                        throw new NullReferenceException("Could not Authenticate!");
                    }
                }

                var httpClient = new HttpClient();
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
                return(new Client(baseUri, httpClient));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IdentityProviderClient(HttpClient client, IdentityConfig config)
        {
            _httpClient = client;

            _oktaTokenService = new OktaTokenService(_httpClient, config);
        }