客户端

2016-10-08  本文已影响1684人  灭蒙鸟

layout: docs-default

Clients

Client类是OpenID Connect或者OAuth2客户端的一个抽象--比如:原生应用,网站应用,基于JS的前端应用(链接).

还有一些关于更新令牌的设置,请看这里

例子:为隐式处理流程配置客户端

var client = new Client
{
    ClientName = "JS Client",
    Enabled = true,

    ClientId = "implicitclient",
    Flow = Flows.Implicit,

    RequireConsent = true,
    AllowRememberConsent = true,

    RedirectUris = new List<string>
    {
        "https://myapp/callback.html",
    },

    PostLogoutRedirectUris = new List<string>
    {
        "http://localhost:23453/index.html",
    }
}

例子:为客户端配置资源所有者的处理流程

var client = new Client
{
    ClientName = "Legacy Client",
    Enabled = true,

    ClientId = "legacy",
    ClientSecrets = new List<Secret>
    {
        new Secret("4C701024-0770-4794-B93D-52B5EB6487A0".Sha256())
    },

    Flow = Flows.ResourceOwner,

    AbsoluteRefreshTokenLifetime = 86400,
    SlidingRefreshTokenLifetime = 43200,
    RefreshTokenUsage = TokenUsage.OneTimeOnly,
    RefreshTokenExpiration = TokenExpiration.Sliding
}
上一篇下一篇

猜你喜欢

热点阅读