-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into kafka-sink-errors
- Loading branch information
Showing
212 changed files
with
7,195 additions
and
2,372 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package auth.cookie; | ||
|
||
import com.google.inject.AbstractModule; | ||
import play.api.libs.crypto.CookieSigner; | ||
import play.api.libs.crypto.CookieSignerProvider; | ||
import play.api.mvc.DefaultFlashCookieBaker; | ||
import play.api.mvc.FlashCookieBaker; | ||
import play.api.mvc.SessionCookieBaker; | ||
|
||
|
||
public class CustomCookiesModule extends AbstractModule { | ||
|
||
@Override | ||
public void configure() { | ||
bind(CookieSigner.class).toProvider(CookieSignerProvider.class); | ||
// We override the session cookie baker to not use a fallback, this prevents using an old URL Encoded cookie | ||
bind(SessionCookieBaker.class).to(CustomSessionCookieBaker.class); | ||
// We don't care about flash cookies, we don't use them | ||
bind(FlashCookieBaker.class).to(DefaultFlashCookieBaker.class); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
datahub-frontend/app/auth/cookie/CustomSessionCookieBaker.scala
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,25 @@ | ||
package auth.cookie | ||
|
||
import com.google.inject.Inject | ||
import play.api.http.{SecretConfiguration, SessionConfiguration} | ||
import play.api.libs.crypto.CookieSigner | ||
import play.api.mvc.DefaultSessionCookieBaker | ||
|
||
import scala.collection.immutable.Map | ||
|
||
/** | ||
* Overrides default fallback to URL Encoding behavior, prevents usage of old URL encoded session cookies | ||
* @param config | ||
* @param secretConfiguration | ||
* @param cookieSigner | ||
*/ | ||
class CustomSessionCookieBaker @Inject() ( | ||
override val config: SessionConfiguration, | ||
override val secretConfiguration: SecretConfiguration, | ||
cookieSigner: CookieSigner | ||
) extends DefaultSessionCookieBaker(config, secretConfiguration, cookieSigner) { | ||
// Has to be a Scala class because it extends a trait with concrete implementations, Scala does compilation tricks | ||
|
||
// Forces use of jwt encoding and disallows fallback to legacy url encoding | ||
override def decode(encodedData: String): Map[String, String] = jwtCodec.decode(encodedData) | ||
} |
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.