Exemplo n.º 1
0
        public IConfidentialClientApplication CreateForIdentifier(string identifier)
        {
            var app = ConfidentialClientApplicationBuilder.Create(_config.ClientId).WithRedirectUri(_config.RedirectUri).WithTenantId(_config.TenantId).WithCertificate(_config.Certificate).Build();

            _tokenCacheAccessor.Configure(identifier);
            app.AddPerUserTokenCache(_tokenCacheAccessor);
            return(app);
        }
Exemplo n.º 2
0
        public IConfidentialClientApplication CreateForIdentifier(ClaimsPrincipal principal, bool useChina = false)
        {
            _log.LogTrace("Creating msal client for principal");
            var app = this.Create(useChina);

            _log.LogTrace($"Principal identifer: {principal.DeriveUserIdentifier()}");
            _tokenCacheAccessor.Configure(principal.DeriveUserIdentifier());
            app.AddPerUserTokenCache(_tokenCacheAccessor);
            return(app);
        }