public KinlyPlatformService(HttpClient httpClient, ICustomJwtTokenProvider customJwtTokenProvider,
                             string kinlySelfTestScoreEndpointUrl)
 {
     _httpClient                    = httpClient;
     _customJwtTokenProvider        = customJwtTokenProvider;
     _kinlySelfTestScoreEndpointUrl = kinlySelfTestScoreEndpointUrl;
 }
示例#2
0
        private static IKinlyPlatformService BuildKinlyPlatformService(HttpClient httpClient,
                                                                       ICustomJwtTokenProvider customJwtTokenProvider, ServiceSettings serviceSettings)
        {
            var service = new KinlyPlatformService(httpClient, customJwtTokenProvider,
                                                   serviceSettings.KinlySelfTestScoreEndpointUrl);

            return(service);
        }
示例#3
0
 public TokenController(IHashGenerator hashGenerator,
                        ICustomJwtTokenProvider customJwtTokenProvider,
                        KinlyConfiguration kinlyConfiguration)
 {
     _hashGenerator          = hashGenerator;
     _customJwtTokenProvider = customJwtTokenProvider;
     _kinlyConfiguration     = kinlyConfiguration;
 }
示例#4
0
        public void Setup()
        {
            var secretKey           = "6t8obpbl0iHOSvDpnUImSdZjYEpTcaEWC8SzLO4/X6iOHArHEm/3Ja6NnzaKS6JwE3U/Bjy1LE/bARMqNCN98w==";
            var customTokenSettings = new KinlyConfiguration {
                ApiSecret = secretKey, Audience = Audience, Issuer = Issuer
            };

            _customJwtTokenProvider = new CustomJwtTokenProvider(customTokenSettings);
            _customJwtTokenHandler  = new CustomJwtTokenHandler(customTokenSettings);
        }
示例#5
0
        public void Should_be_invalid_token_when_token_generated_with_different_secret()
        {
            var secretKey           = "F8pf/zwOgm/kASEFs+BKRDdyq+RhHCQ9i9tPjeaPjUebm6HvzXKIsr/nX28wpwAZoWRG0FQK9LVf6nrkW/vg4w==";
            var customTokenSettings = new KinlyConfiguration {
                ApiSecret = secretKey, Audience = Audience, Issuer = Issuer
            };

            _customJwtTokenProvider = new CustomJwtTokenProvider(customTokenSettings);

            var token = _customJwtTokenProvider.GenerateApiToken("Test User", 1);

            var claimsPrincipal = _customJwtTokenHandler.IsValidToken(token);

            claimsPrincipal.Should().BeFalse();
        }
示例#6
0
 public KinlyPlatformService(ICustomJwtTokenProvider customJwtTokenProvider, string kinlySelfTestScoreEndpointUrl)
 {
     _customJwtTokenProvider        = customJwtTokenProvider;
     _kinlySelfTestScoreEndpointUrl = kinlySelfTestScoreEndpointUrl;
 }
 public KinlyApiTokenDelegatingHandler(ICustomJwtTokenProvider tokenProvider)
 {
     _tokenProvider = tokenProvider;
 }
示例#8
0
 public KinlySelfTestApiDelegatingHandler(ICustomJwtTokenProvider tokenProvider)
 {
     _tokenProvider = tokenProvider;
 }