예제 #1
0
        public async Task <TokenHolder> AuthenticateAsync()
        {
            var values = new Dictionary <string, string>
            {
                ["grant_type"]    = "client_credentials",
                ["client_id"]     = _clientId.ToInsecureString(),
                ["client_secret"] = _clientSecret.ToInsecureString(),
                ["scope"]         = "openid " + _applicationScopes
            };
            var tokenInfo = await OpenIdUtils.ExecuteTokenRequest(_httpClient, values);

            return(new TokenHolder(tokenInfo, _applicationScopes));
        }
예제 #2
0
        public async Task <TokenHolder> AuthenticateAsync()
        {
            var scopes = "email phone profile roles";
            var values = new Dictionary <string, string>
            {
                ["grant_type"] = "password",
                ["username"]   = _username.ToInsecureString(),
                ["password"]   = _password.ToInsecureString(),
                ["scope"]      = "openid offline_access " + scopes
            };
            var tokenInfo = await OpenIdUtils.ExecuteTokenRequest(_httpClient, values);

            return(new TokenHolder(tokenInfo, scopes));
        }