private void RequestToken(string scope, string responseType)
        {
            var client   = new OAuth2Client(new Uri(Constants.AuthorizeEndpoint));
            var startUrl = client.CreateAuthorizeUrl(
                clientId: Constants.ClientId,
                responseType: responseType,
                scope: scope,
                redirectUri: Constants.ClientRedirectUrl,
                state: "random_state",
                nonce: "random_nonce");

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri(Constants.ClientRedirectUrl));
        }
Пример #2
0
        private void RequestToken(string scope, string responseType)
        {
            var request  = new AuthorizeRequest(Constants.AuthorizeEndpoint);
            var startUrl = request.CreateAuthorizeUrl(
                clientId: "hybridclient",
                responseType: responseType,
                scope: scope,
                redirectUri: "oob://localhost/wpfclient",
                state: "random_state",
                nonce: "random_nonce");

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpfclient"));
        }
Пример #3
0
        private void RequestToken(string scope, string responseType)
        {
            var client   = new OAuth2Client(new Uri(Constants.AuthorizeEndpoint));
            var startUrl = client.CreateAuthorizeUrl(
                clientId: "hybridclient",
                //clientId: "7b3e70c3-32f7-4b32-82b9-93260ff47b47",
                responseType: responseType,
                scope: scope,
                redirectUri: "oob://localhost/wpfclient",
                state: "random_state",
                nonce: "random_nonce");

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpfclient"));
        }
        private void RequestToken(string scope, string responseType)
        {
            var client   = new OAuth2Client(new Uri(Constants.AuthorizeEndpoint));
            var startUrl = client.CreateAuthorizeUrl(
                clientId: "implicitclient",
                responseType: responseType,
                scope: scope,
                redirectUri: "oob://localhost/wpfclient",
                state: "random_state",
                nonce: "random_nonce" /**,
                                       * loginHint: "alice",
                                       * acrValues: "idp:Google b c" **/);

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpfclient"));
        }
Пример #5
0
        private void RequestToken(string scope, string responseType)
        {
            var request  = new AuthorizeRequest(Constants.AuthorizeEndpoint);
            var startUrl = request.CreateAuthorizeUrl(
                clientId: "wpf.webview.client",
                responseType: responseType,
                responseMode: "form_post",
                scope: scope,
                redirectUri: "oob://localhost/wpf.webview.client",
                state: "random_state",
                nonce: "random_nonce" /**,
                                       * loginHint: "alice",
                                       * acrValues: "idp:Google b c" **/);

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpf.webview.client"));
        }
Пример #6
0
        private void RequestToken(string scope, string responseType)
        {
            var client = new OAuth2Client(new Uri(Constants.AuthorizeEndpoint));
            //var client = new OAuth2Client(new Uri("https://login.microsoftonline.com/70248591-7dbf-4c5c-a3e3-0a009f207bb2/oauth2/authorize"));
            var startUrl = client.CreateAuthorizeUrl(
                clientId: "implicitclient",
                //clientId: "7b3e70c3-32f7-4b32-82b9-93260ff47b47",
                responseType: responseType,
                scope: scope,
                redirectUri: "oob://localhost/wpfclient",
                state: "random_state",
                nonce: "random_nonce" /**,
                                       * loginHint: "alice",
                                       * acrValues: "idp:Google b c" **/);

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpfclient"));
        }
Пример #7
0
        /// <summary>
        /// Creates the authorization request and shows the popup with the Web View.
        /// When the login is succesfully complete triggers you the LoginDone event.
        /// </summary>
        public void Login(string scope, string responseType)
        {
            const string redirectUri = "oob://localhost/wpf.webview.client";

            var request = new RequestUrl($"{AppSettings.Settings.Endpoint}identity/connect/authorize");

            var startUrl = request.CreateAuthorizeUrl(
                clientId: AppSettings.Settings.ClientId,
                responseType: responseType,
                scope: scope,
                redirectUri: redirectUri,
                nonce: CryptoRandom.CreateUniqueId());

            _login       = new LoginWebView();
            _login.Done += _login_Done;
            _login.Show();
            _login.Start(new Uri(startUrl), new Uri(redirectUri));
        }
        private void RequestToken(string scope, string responseType)
        {
            var additional = new Dictionary <string, string>
            {
                { "nonce", "nonce" }
            };

            var client   = new OAuth2Client(new Uri(Constants.AuthorizeEndpoint));
            var startUrl = client.CreateAuthorizeUrl(
                "implicitclient",
                responseType,
                scope,
                "oob://localhost/wpfclient",
                "state",
                additional);


            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpfclient"));
        }
Пример #9
0
        private void RequestToken(string scope, string responseType)
        {
            var additional = new Dictionary <string, string>
            {
                { "nonce", "should_be_random" },
                // { "login_hint", "idp:Google" },
                // { "acr_values", "a b c" }
            };

            var client   = new OAuth2Client(new Uri(Constants.AuthorizeEndpoint));
            var startUrl = client.CreateAuthorizeUrl(
                "implicitclient",
                responseType,
                scope,
                "oob://localhost/wpfclient",
                "random_state",
                additional);

            _login.Show();
            _login.Start(new Uri(startUrl), new Uri("oob://localhost/wpfclient"));
        }