Skip to content

Commit

Permalink
fix(oauth): remove samesite cookie attribute (#803)
Browse files Browse the repository at this point in the history
Similar to #801 when using oauth removes the samesite attribute from
the session cookie.
  • Loading branch information
cfieber authored May 16, 2019
1 parent c25fd51 commit cfeaf8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions gate-oauth2/gate-oauth2.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dependencies {
implementation project(":gate-core")
implementation "org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure"
implementation "org.springframework.session:spring-session-core"
implementation "com.squareup.retrofit:converter-simplexml"
implementation "com.netflix.spinnaker.kork:kork-security"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.springframework.security.oauth2.client.token.grant.code.Authorization
import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
import org.springframework.session.web.http.DefaultCookieSerializer
import org.springframework.stereotype.Component

import javax.servlet.http.HttpServletRequest
Expand All @@ -60,6 +61,9 @@ class OAuth2SsoConfig extends WebSecurityConfigurerAdapter {
@Autowired
ExternalSslAwareEntryPoint entryPoint

@Autowired
DefaultCookieSerializer defaultCookieSerializer

@Primary
@Bean
ResourceServerTokenServices spinnakerUserInfoTokenServices() {
Expand All @@ -73,6 +77,7 @@ class OAuth2SsoConfig extends WebSecurityConfigurerAdapter {

@Override
void configure(HttpSecurity http) throws Exception {
defaultCookieSerializer.setSameSite(null)
authConfig.configure(http)

http.exceptionHandling().authenticationEntryPoint(entryPoint)
Expand Down

0 comments on commit cfeaf8a

Please sign in to comment.