public string CreateAuthorizationRequest() { // Create URI to authorization endpoint var authorizeRequest = new AuthorizeRequest(GlobalSetting.Instance.IdentityEndpoint); // Dictionary with values for the authorize request var dic = new Dictionary <string, string>(); dic.Add("client_id", GlobalSetting.Instance.ClientId); dic.Add("client_secret", GlobalSetting.Instance.ClientSecret); dic.Add("response_type", "code id_token"); dic.Add("scope", "openid profile basket orders locations marketing offline_access"); dic.Add("redirect_uri", GlobalSetting.Instance.IdentityCallback); dic.Add("nonce", Guid.NewGuid().ToString("N")); dic.Add("code_challenge", CreateCodeChallenge()); dic.Add("code_challenge_method", "S256"); // Add CSRF token to protect against cross-site request forgery attacks. var currentCSRFToken = Guid.NewGuid().ToString("N"); dic.Add("state", currentCSRFToken); var authorizeUri = authorizeRequest.Create(dic); return(authorizeUri); }
public void StartFlow(string responseType, string scope) { // create URI to authorize endpoint - use WebHost or SelfHost from the // samples solution. var authorizeRequest = new AuthorizeRequest("https://localhost:44333/core/connect/authorize"); // dictionary with values for the authorize request var dic = new Dictionary <string, string>(); dic.Add("client_id", "implicitclient"); dic.Add("response_type", responseType); dic.Add("scope", scope); dic.Add("redirect_uri", "https://xamarin-oidc-sample/redirect"); dic.Add("nonce", Guid.NewGuid().ToString("N")); // add CSRF token to protect against cross-site request forgery attacks. _currentCSRFToken = Guid.NewGuid().ToString("N"); dic.Add("state", _currentCSRFToken); var authorizeUri = authorizeRequest.Create(dic); // or use CreateAuthorizeUrl, passing in the values we defined in the dictionary. // authorizeRequest.CreateAuthorizeUrl("implicitclient", ...); wvLogin.Source = authorizeUri; wvLogin.IsVisible = true; }
public void StartFlow(string responseType, string scope) { // create URI to auth endpoint var authorizeRequest = new AuthorizeRequest("https://xamarinoidcsamplests.azurewebsites.net/identity/connect/authorize"); // note: change URI to wherever you deployed your STS (CTRL-SHIFT-F is your friend :)). // For use with IIS Express, check https://www.github.com/KevinDockx/XamarinFormsOIDCSample. // dictionary with values for the authorize request var dic = new Dictionary <string, string>(); dic.Add("client_id", "xamarinsampleimplicit"); dic.Add("response_type", responseType); dic.Add("scope", scope); dic.Add("redirect_uri", "https://xamarin-oidc-sample/redirect"); dic.Add("nonce", Guid.NewGuid().ToString("N")); // add CSRF token to protect against cross-site request forgery attacks. _currentCSRFToken = Guid.NewGuid().ToString("N"); dic.Add("state", _currentCSRFToken); var authorizeUri = authorizeRequest.Create(dic); // or use CreateAuthorizeUrl, passing in the values we defined in the dictionary. // authorizeRequest.CreateAuthorizeUrl("xamarinsampleimplicit", ...); wvLogin.Source = authorizeUri; wvLogin.IsVisible = true; }
public void Create_relative_url_should_behave_as_expected() { var request = new AuthorizeRequest(new Uri("/authorize", UriKind.Relative)); var parmeters = new { foo = "foo", bar = "bar" }; var url = request.Create(parmeters); Assert.AreEqual("/authorize?foo=foo&bar=bar", url); }
public void Create_absolute_url_should_behave_as_expected() { var request = new AuthorizeRequest("http://server/authorize"); var parmeters = new { foo = "foo", bar = "bar" }; var url = request.Create(parmeters); Assert.AreEqual("http://server/authorize?foo=foo&bar=bar", url); }
private UrlWebViewSource CreateAuthUrl() { var result = new UrlWebViewSource(); var authorizeRequest = new AuthorizeRequest(ApiKeys.AuthorizeUrl); var dic = new Dictionary <string, string>(); dic.Add("client_id", ApiKeys.ClientId); dic.Add("response_type", "Assertion"); dic.Add("scope", ApiKeys.Scope); dic.Add("redirect_uri", ApiKeys.RedirectUrl); _currentCSRFToken = Guid.NewGuid().ToString("N"); dic.Add("state", _currentCSRFToken); result.Url = authorizeRequest.Create(dic); return(result); }
public void StartFlow(string responseType, string scope) { var authorizeRequest = new AuthorizeRequest("https://api.worldoftanks.com/wot/auth/login/"); // dictionary with values for the authorize request var dic = new Dictionary <string, string>(); dic.Add("application_id", "715ee34f2bb9baeb9a825cf74b717e75"); dic.Add("display", "page"); dic.Add("expires_at", "1482537600"); dic.Add("nofollow", "0"); dic.Add("redirect_uri", "https://developers.wargaming.net/reference/all/wot/auth/login/"); var authorizeUri = authorizeRequest.Create(dic); wvLogin.Source = authorizeUri; wvLogin.IsVisible = true; }
public string CreateAuthorizationRequest() { // Create URI to authorization endpoint var authorizeRequest = new AuthorizeRequest(GlobalSetting.Instance.IdentityEndpoint); // Dictionary with values for requeset var dic = new Dictionary <string, string>(); dic.Add("client_id", "xamarin"); dic.Add("response_type", "id_token token"); dic.Add("scope", "openid profile basket orders"); dic.Add("redirect_url", GlobalSetting.Instance.IdentityCallback); dic.Add("nonce", Guid.NewGuid().ToString("N")); // Add CSRF token to protect against cross-site request forgery attacks var currentCSRFToken = Guid.NewGuid().ToString("N"); dic.Add("state", currentCSRFToken); var authorizeUri = authorizeRequest.Create(dic); return(authorizeUri); }