Skip to content

Commit b04784c

Browse files
committed
feat(oauth): add a default cookie options
1 parent c4305ec commit b04784c

File tree

6 files changed

+14
-1
lines changed

6 files changed

+14
-1
lines changed

aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OAuth/ExternalProviders/Bilibili/BilibiliAuthHandlerOptionsProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ public async override Task SetOptionsAsync(BilibiliAuthenticationOptions options
2525
{
2626
options.ClientSecret = clientSecret;
2727
}
28+
await base.SetOptionsAsync(options);
2829
}
2930
}

aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OAuth/ExternalProviders/GitHub/GitHubAuthHandlerOptionsProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ public async override Task SetOptionsAsync(GitHubAuthenticationOptions options)
2525
{
2626
options.ClientSecret = clientSecret;
2727
}
28+
await base.SetOptionsAsync(options);
2829
}
2930
}

aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OAuth/ExternalProviders/OAuthHandlerOptionsProvider.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.AspNetCore.Authentication;
2+
using Microsoft.AspNetCore.Http;
23
using System.Threading.Tasks;
34
using Volo.Abp.DependencyInjection;
45
using Volo.Abp.Settings;
@@ -14,5 +15,12 @@ public OAuthHandlerOptionsProvider(ISettingProvider settingProvider)
1415
SettingProvider = settingProvider;
1516
}
1617

17-
public abstract Task SetOptionsAsync(TOptions options);
18+
public virtual Task SetOptionsAsync(TOptions options)
19+
{
20+
options.CorrelationCookie.SameSite = SameSiteMode.Lax;
21+
options.CorrelationCookie.SecurePolicy = CookieSecurePolicy.SameAsRequest;
22+
options.CorrelationCookie.HttpOnly = true;
23+
24+
return Task.CompletedTask;
25+
}
1826
}

aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OAuth/ExternalProviders/QQ/QQAuthHandlerOptionsProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ public async override Task SetOptionsAsync(QQAuthenticationOptions options)
2525
{
2626
options.ClientSecret = clientSecret;
2727
}
28+
await base.SetOptionsAsync(options);
2829
}
2930
}

aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OAuth/ExternalProviders/WeChat/WeChatAuthHandlerOptionsProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ public async override Task SetOptionsAsync(WeixinAuthenticationOptions options)
2525
{
2626
options.ClientSecret = clientSecret;
2727
}
28+
await base.SetOptionsAsync(options);
2829
}
2930
}

aspnet-core/modules/account/LINGYUN.Abp.Account.Web.OAuth/ExternalProviders/WeCom/WeComAuthHandlerOptionsProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ public async override Task SetOptionsAsync(WorkWeixinAuthenticationOptions optio
3030
{
3131
options.AgentId = agentId;
3232
}
33+
await base.SetOptionsAsync(options);
3334
}
3435
}

0 commit comments

Comments
 (0)