Esempio n. 1
0
        private IAuthenticationProvider CreateAuthorizationProvider(Type t)
        {
            List <string> scopes = new List <string>
            {
                "https://graph.microsoft.com/.default"
            };

            var pca = PublicClientApplicationBuilder.Create(_options.ClientId)
                      .WithAuthority($"{_options.Instance}common/")
                      .WithRedirectUri(_options.RedirectUri)
                      .Build();

            TokenCacheHelper.EnableSerialization(pca.UserTokenCache);

            return((IAuthenticationProvider)Activator.CreateInstance(t, new object[] { pca, scopes }));
        }
Esempio n. 2
0
        private IAuthenticationProvider CreateAuthorizationProvider(Type t)
        {
            var clientId    = _options.ApplicationId;
            var redirectUri = _options.RedirectUri;
            var authority   = $"https://login.microsoftonline.com/{_options.TenantId}";

            List <string> scopes = new List <string>
            {
                "https://graph.microsoft.com/.default"
            };

            var pca = PublicClientApplicationBuilder.Create(clientId)
                      .WithAuthority(authority)
                      .WithRedirectUri(redirectUri)
                      .Build();

            TokenCacheHelper.EnableSerialization(pca.UserTokenCache);

            return((IAuthenticationProvider)Activator.CreateInstance(t, new object[] { pca, scopes }));
        }