Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"

- name: Setup Clojure
uses: DeLaGuardo/setup-clojure@13.4
with:
lein: latest

- run: lein deps

Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Release date `UNRELEASED`

- (docs api exchange): unify arglists, add link to javadocs
- (docs api exchange): unify arglists, add a link to Javadocs
- (chore): upgrade an Undertow version to "2.4.1.Final"
+ (refactor): fix reflection warnings after undertow upgrade
+ (feat): require Java version 17+

## `1.4.0-125`

Expand Down
6 changes: 3 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
:url "https://github.com/strojure/undertow"
:license {:name "The Unlicense" :url "https://unlicense.org"}

:dependencies [[io.undertow/undertow-core "2.3.5.Final"]
:dependencies [[io.undertow/undertow-core "2.4.1.Final"]
[com.github.strojure/web-security "1.2.0-38"]]

:java-source-paths ["src"]
:javac-options ["-source" "11" "-target" "11"]
:javac-options ["--release" "17"]

:profiles {:provided {:dependencies [[org.clojure/clojure "1.11.1"]]}
:profiles {:provided {:dependencies [[org.clojure/clojure "1.12.5"]]}
:dev,,,,, {:dependencies [;; Testing HTTP requests
[java-http-clj "0.4.3"]]
:source-paths ["doc"]}}
Expand Down
18 changes: 9 additions & 9 deletions src/strojure/undertow/handler/session.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
#_{:clj-kondo/ignore [:shadowed-var]}
[{:keys [cookie-name, path, domain, discard, secure, http-only, same-site, max-age, comment]
:or {http-only true, same-site "Lax"}}]
(let [config (cond-> (SessionCookieConfigPlus.)
(let [config (cond-> (new SessionCookieConfigPlus)
(string? same-site) (.setSameSiteMode (name same-site)))]
(cond-> ^SessionCookieConfig config
cookie-name (.setCookieName cookie-name)
path (.setPath path)
domain (.setDomain domain)
(some? discard) (.setDiscard (boolean discard))
(some? secure) (.setSecure (boolean secure))
(some? http-only) (.setHttpOnly (boolean http-only))
max-age (.setMaxAge max-age)
comment (.setComment comment))))
cookie-name ^SessionCookieConfig (.setCookieName cookie-name)
path ^SessionCookieConfig (.setPath path)
domain ^SessionCookieConfig (.setDomain domain)
(some? discard) ^SessionCookieConfig (.setDiscard (boolean discard))
(some? secure) ^SessionCookieConfig (.setSecure (boolean secure))
(some? http-only) ^SessionCookieConfig (.setHttpOnly (boolean http-only))
max-age ^SessionCookieConfig (.setMaxAge max-age)
comment ^SessionCookieConfig (.setComment comment))))

(comment
(session-cookie-config {:same-site "Lax"})
Expand Down
4 changes: 2 additions & 2 deletions test/strojure/undertow/handler_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@
(let [cookie (-> (exec {:handler (session-config-handler {:secure true
:same-site "none"})})
:headers (get "set-cookie"))]
(test/is (string/includes? cookie "secure"))
(test/is (string/includes? cookie "Secure"))
(test/is (string/includes? cookie "SameSite=None")))

(let [cookie (-> (exec {:handler (session-config-handler {:http-only false
:secure false
:same-site nil})})
:headers (get "set-cookie"))]
(test/is (not (string/includes? cookie "HttpOnly")))
(test/is (not (string/includes? cookie "secure")))
(test/is (not (string/includes? cookie "Secure")))
(test/is (not (string/includes? cookie "SameSite"))))

(let [cookie (-> (exec {:handler (session-config-handler {:same-site false})})
Expand Down
Loading