Changed Xamarin app authentication to Hybrid flow mode
This commit is contained in:
commit
af2d37bcc6
@ -14,8 +14,9 @@ namespace eShopOnContainers.Core.Services.Identity
|
|||||||
// Dictionary with values for the authorize request
|
// Dictionary with values for the authorize request
|
||||||
var dic = new Dictionary<string, string>();
|
var dic = new Dictionary<string, string>();
|
||||||
dic.Add("client_id", "xamarin");
|
dic.Add("client_id", "xamarin");
|
||||||
dic.Add("response_type", "id_token token");
|
dic.Add("client_secret", "secret");
|
||||||
dic.Add("scope", "openid profile basket orders");
|
dic.Add("response_type", "code id_token token");
|
||||||
|
dic.Add("scope", "openid profile basket orders offline_access");
|
||||||
|
|
||||||
dic.Add("redirect_uri", GlobalSetting.Instance.IdentityCallback);
|
dic.Add("redirect_uri", GlobalSetting.Instance.IdentityCallback);
|
||||||
dic.Add("nonce", Guid.NewGuid().ToString("N"));
|
dic.Add("nonce", Guid.NewGuid().ToString("N"));
|
||||||
@ -24,7 +25,7 @@ namespace eShopOnContainers.Core.Services.Identity
|
|||||||
var currentCSRFToken = Guid.NewGuid().ToString("N");
|
var currentCSRFToken = Guid.NewGuid().ToString("N");
|
||||||
dic.Add("state", currentCSRFToken);
|
dic.Add("state", currentCSRFToken);
|
||||||
|
|
||||||
var authorizeUri = authorizeRequest.Create(dic);
|
var authorizeUri = authorizeRequest.Create(dic);
|
||||||
return authorizeUri;
|
return authorizeUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using IdentityServer4.Models;
|
using IdentityServer4;
|
||||||
using Microsoft.Extensions.Options;
|
using IdentityServer4.Models;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using IdentityServer4;
|
|
||||||
|
|
||||||
namespace Identity.API.Configuration
|
namespace Identity.API.Configuration
|
||||||
{
|
{
|
||||||
@ -56,19 +55,26 @@ namespace Identity.API.Configuration
|
|||||||
{
|
{
|
||||||
ClientId = "xamarin",
|
ClientId = "xamarin",
|
||||||
ClientName = "eShop Xamarin OpenId Client",
|
ClientName = "eShop Xamarin OpenId Client",
|
||||||
AllowedGrantTypes = GrantTypes.Implicit,
|
AllowedGrantTypes = GrantTypes.Hybrid,
|
||||||
AllowAccessTokensViaBrowser = true,
|
//Used to retrieve the access token on the back channel.
|
||||||
RedirectUris = { clientsUrl["Xamarin"] },
|
ClientSecrets =
|
||||||
|
{
|
||||||
|
new Secret("secret".Sha256())
|
||||||
|
},
|
||||||
|
RedirectUris = { clientsUrl["Xamarin"] },
|
||||||
RequireConsent = false,
|
RequireConsent = false,
|
||||||
PostLogoutRedirectUris = { $"{clientsUrl["Xamarin"]}/Account/Redirecting" },
|
PostLogoutRedirectUris = { $"{clientsUrl["Xamarin"]}/Account/Redirecting" },
|
||||||
AllowedCorsOrigins = { "http://eshopxamarin" },
|
AllowedCorsOrigins = { "http://eshopxamarin" },
|
||||||
AllowedScopes =
|
AllowedScopes = new List<string>
|
||||||
{
|
{
|
||||||
IdentityServerConstants.StandardScopes.OpenId,
|
IdentityServerConstants.StandardScopes.OpenId,
|
||||||
IdentityServerConstants.StandardScopes.Profile,
|
IdentityServerConstants.StandardScopes.Profile,
|
||||||
|
IdentityServerConstants.StandardScopes.OfflineAccess,
|
||||||
"orders",
|
"orders",
|
||||||
"basket"
|
"basket"
|
||||||
}
|
},
|
||||||
|
//Allow requesting refresh tokens for long lived API access
|
||||||
|
AllowOfflineAccess = true
|
||||||
},
|
},
|
||||||
new Client
|
new Client
|
||||||
{
|
{
|
||||||
@ -96,7 +102,7 @@ namespace Identity.API.Configuration
|
|||||||
IdentityServerConstants.StandardScopes.Profile,
|
IdentityServerConstants.StandardScopes.Profile,
|
||||||
IdentityServerConstants.StandardScopes.OfflineAccess,
|
IdentityServerConstants.StandardScopes.OfflineAccess,
|
||||||
"orders",
|
"orders",
|
||||||
"basket",
|
"basket"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user