mirror of
https://github.com/bitwarden/server.git
synced 2025-04-17 11:08:16 -05:00
changes from v1.3.5 for api clients
This commit is contained in:
parent
c8ef5f3527
commit
db4590bcfe
@ -9,22 +9,30 @@ namespace Bit.Api.IdentityServer
|
|||||||
{
|
{
|
||||||
return new List<Client>
|
return new List<Client>
|
||||||
{
|
{
|
||||||
new ApiClient("mobile"),
|
new ApiClient("mobile", 90, 1),
|
||||||
new ApiClient("web"),
|
new ApiClient("web", 1, 1),
|
||||||
new ApiClient("browser"),
|
new ApiClient("browser", 30, 1),
|
||||||
new ApiClient("desktop")
|
new ApiClient("desktop", 30, 1)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApiClient : Client
|
public class ApiClient : Client
|
||||||
{
|
{
|
||||||
public ApiClient(string id, string[] additionalScopes = null)
|
public ApiClient(
|
||||||
|
string id,
|
||||||
|
int refreshTokenSlidingDays,
|
||||||
|
int accessTokenLifetimeHours,
|
||||||
|
string[] additionalScopes = null)
|
||||||
{
|
{
|
||||||
ClientId = id;
|
ClientId = id;
|
||||||
RequireClientSecret = false;
|
RequireClientSecret = false;
|
||||||
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword;
|
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword;
|
||||||
|
RefreshTokenExpiration = TokenExpiration.Sliding;
|
||||||
|
RefreshTokenUsage = TokenUsage.ReUse;
|
||||||
|
SlidingRefreshTokenLifetime = 86400 * refreshTokenSlidingDays;
|
||||||
|
AbsoluteRefreshTokenLifetime = int.MaxValue; // forever
|
||||||
UpdateAccessTokenClaimsOnRefresh = true;
|
UpdateAccessTokenClaimsOnRefresh = true;
|
||||||
AccessTokenLifetime = 60 * 60; // 1 hour
|
AccessTokenLifetime = 3600 * accessTokenLifetimeHours;
|
||||||
AllowOfflineAccess = true;
|
AllowOfflineAccess = true;
|
||||||
|
|
||||||
var scopes = new List<string> { "api" };
|
var scopes = new List<string> { "api" };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user