}elsecontext.Result=newGrantValidationResult(TokenRequestErrors.InvalidGrant,"用户名密码错误");awaitTask.CompletedTask; } } 下面是client配置 newClient(){ ClientId="userservices", ClientName="用户服务", ClientSecrets=newList<Secret>{newSecret("secret".Sha256()) }, AllowedGrantTypes=newList<string>...
// no interactive user, use the clientid/secret for authenticationAllowedGrantTypes=GrantTypes.ClientCredentials,// secret for authenticationClientSecrets={newSecret("secret-123456".Sha256())},// scopes that client has access toAllowedScopes={"api1"}},//Resource Owner Password Credentials ClientnewC...
{//new Client{// ClientId = "iphone",// ClientSecrets = new List<Secret>// {// new Secret("secret".Sha256())// },// RefreshTokenExpiration = TokenExpiration.Sliding,// AllowOfflineAccess = true,// RequireClientSecret = false,// AllowedGrantTypes = new List<string>{ "sms_auth_cod...
}; 接着,定义客户,即用于访问新API的客户端应用程序。 public static IEnumerable<Client> Clients => new List<Client> { new Client { // 定义客户端ID ClientId = "client", // 授权方式为客户端凭据模式,类型可参考GrantTypes枚举 AllowedGrantTypes = GrantTypes.ClientCredentials, // 定义客户端秘钥 Cl...
在Config中配置客户端(client)中定义了一个 AllowedGrantTypes 的属性,这个属性决定了Client可以被哪种模式被访问,「GrantTypes.Code」为「授权码模式」。所以在本文中我们需要添加一个Client用于支持授权码模式(「Authorization Code」)。 ❞ 3.2 搭建API资源 ...
}; 然后,定义客户,即用于访问新API的客户端应用程序。 public static IEnumerable<Client> Clients => new List<Client> { new Client { ClientId = "mvc", ClientSecrets = { new Secret("secret".Sha256()) }, AllowedGrantTypes = GrantTypes.Code, ...
newClient{ ClientId ="client1", AllowedGrantTypes = GrantTypes.List(GrantTypes.ResourceOwnerPassword.FirstOrDefault(),"anonymous"),//一个 Client 可以配置多个 GrantTypeAllowOfflineAccess =true, AccessTokenLifetime =3600*6,//6小时SlidingRefreshTokenLifetime =1296000,//15天ClientSecrets = {newSecret...
newClient{ClientId="mvc",ClientSecrets={newSecret("secret-mvc".Sha256())},AllowedGrantTypes=GrantTypes.Code,RequireConsent=true,// where to redirect to after loginRedirectUris={"http://localhost:6002/signin-oidc"},// where to redirect to after logoutPostLogoutRedirectUris={"http://localhost...
在Config中配置客户端(client)中定义了一个AllowedGrantTypes的属性,这个属性决定了Client可以被哪种模式被访问,GrantTypes.Code为授权码模式。所以在本文中我们需要添加一个Client用于支持授权码模式(Authorization Code)。 3.2 搭建API资源 实现对API资源进行保护 ...
AllowedGrantTypes = GrantTypes.List(GrantTypes.ResourceOwnerPassword.FirstOrDefault(),"anonymous"),//一个 Client 可以配置多个 GrantTypeAllowOfflineAccess =true, AccessTokenLifetime =3600*6,//6小时SlidingRefreshTokenLifetime =1296000,//15天ClientSecrets = ...