-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/2019.1.5' into stable-2019.1
- Loading branch information
Showing
16 changed files
with
189 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Source/Plugins/Core/com.equella.core/src/com/tle/web/core/filter/SameSiteFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to The Apereo Foundation under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* The Apereo Foundation licenses this file to you under the Apache License, | ||
* Version 2.0, (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.tle.web.core.filter; | ||
|
||
import com.tle.core.guice.Bind; | ||
import com.tle.web.dispatcher.AbstractWebFilter; | ||
import com.tle.web.dispatcher.FilterResult; | ||
import java.io.IOException; | ||
import java.util.Collection; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.ws.rs.core.HttpHeaders; | ||
|
||
@Bind | ||
public class SameSiteFilter extends AbstractWebFilter { | ||
|
||
@Override | ||
public FilterResult filterRequest(HttpServletRequest request, HttpServletResponse response) | ||
throws IOException, ServletException { | ||
if (request.isSecure()) { | ||
Collection<String> headers = response.getHeaders(HttpHeaders.SET_COOKIE); | ||
boolean firstHeader = true; | ||
for (String header : headers) { | ||
if (firstHeader) { | ||
response.setHeader( | ||
HttpHeaders.SET_COOKIE, String.format("%s; %s", header, "SameSite=None")); | ||
firstHeader = false; | ||
continue; | ||
} | ||
response.addHeader( | ||
HttpHeaders.SET_COOKIE, String.format("%s; %s", header, "SameSite=None")); | ||
} | ||
} | ||
return FilterResult.FILTER_CONTINUE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.