Created
October 23, 2018 08:17
-
-
Save cy6erGn0m/f30287d961a13e3e1b9d09472ac81ff2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sealed class XFrameOptions { | |
object Deny : XFrameOptions() { | |
override fun toString() = "deny" | |
} | |
object SameOrigin : XFrameOptions() { | |
override fun toString() = "sameorigin" | |
} | |
class AllowFrom(val url: String) : XFrameOptions() { | |
override fun toString(): String = "allow-from $url" | |
} | |
} | |
routing { | |
route("api") { | |
applyFrameOptions(XFrameOptions.Deny) | |
get("fun1") { ... } | |
get("fun2") { ... } | |
} | |
route("some-part") { | |
route("a") { | |
applyFrameOptions(XFrameOptions.SameOrigin) | |
get("...") { ... } | |
} | |
route("b") { | |
applyFrameOptions(XFrameOptions.AllowFrom("https://jetbrains.com")) | |
get("...") { ... } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment