Skip to content

Commit

Permalink
Switch to flat :require style (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul committed Sep 29, 2020
1 parent 1c42204 commit 5e103a9
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 59 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
:check-namespace-decls
{:plugins [[lein-check-namespace-decls "1.0.2"]]
:source-paths ["test"]
:check-namespace-decls {:prefix-rewriting true}}
:check-namespace-decls {:prefix-rewriting false}}

:cloverage
;; Using Cam's fork of Cloverage until 1.2.1 of the main repo is out. Once that's released we can switch back.
Expand Down
10 changes: 4 additions & 6 deletions src/saml20_clj/coerce.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
(ns saml20-clj.coerce
(:require [clojure.java.io :as io]
[clojure.string :as str]
[hiccup
[core :as hiccup]
[page :as h.page]]
[saml20-clj
[encode-decode :as encode-decode]
[xml :as saml.xml]]))
[hiccup.core :as hiccup]
[hiccup.page :as h.page]
[saml20-clj.encode-decode :as encode-decode]
[saml20-clj.xml :as saml.xml]))

;; these have to be initialized before using.
;;
Expand Down
14 changes: 6 additions & 8 deletions src/saml20_clj/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
"Main interface for saml20-clj SP functionality. The core functionality is broken out into several separate
namespaces, but vars are made available here via Potemkin."
(:require [potemkin :as p]
[saml20-clj
[coerce :as coerce]
[encode-decode :as encode]
[state :as state]]
[saml20-clj.sp
[metadata :as metadata]
[request :as request]
[response :as response]]))
[saml20-clj.coerce :as coerce]
[saml20-clj.encode-decode :as encode]
[saml20-clj.sp.metadata :as metadata]
[saml20-clj.sp.request :as request]
[saml20-clj.sp.response :as response]
[saml20-clj.state :as state]))

;; this is so the linter doesn't complain about unused namespaces.
(comment
Expand Down
5 changes: 2 additions & 3 deletions src/saml20_clj/sp/metadata.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(ns saml20-clj.sp.metadata
(:require [clojure.string :as str]
[saml20-clj
[coerce :as coerce]
[encode-decode :as encode]]))
[saml20-clj.coerce :as coerce]
[saml20-clj.encode-decode :as encode]))

(defn metadata [{:keys [app-name acs-url slo-url sp-cert
requests-signed
Expand Down
9 changes: 4 additions & 5 deletions src/saml20_clj/sp/request.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
(:require [clojure.string :as str]
[java-time :as t]
[ring.util.codec :as codec]
[saml20-clj
[coerce :as coerce]
[crypto :as crypto]
[encode-decode :as encode-decode]
[state :as state]]))
[saml20-clj.coerce :as coerce]
[saml20-clj.crypto :as crypto]
[saml20-clj.encode-decode :as encode-decode]
[saml20-clj.state :as state]))

(defn- format-instant
"Converts a date-time to a SAML 2.0 time string."
Expand Down
9 changes: 4 additions & 5 deletions src/saml20_clj/sp/response.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
"Code for parsing the XML response (as a String)from the IdP to an OpenSAML `Response`, and for basic operations like
validating the signature and reading assertions."
(:require [java-time :as t]
[saml20-clj
[coerce :as coerce]
[crypto :as crypto]
[state :as state]
[xml :as xml]])
[saml20-clj.coerce :as coerce]
[saml20-clj.crypto :as crypto]
[saml20-clj.state :as state]
[saml20-clj.xml :as xml])
(:import [org.opensaml.saml.saml2.core Assertion Attribute AttributeStatement Audience AudienceRestriction Response
Subject SubjectConfirmation SubjectConfirmationData]))

Expand Down
10 changes: 4 additions & 6 deletions src/saml20_clj/specs.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
(ns saml20-clj.specs
(:require [clojure.spec.alpha :as s]
[saml20-clj
[coerce :as coerce]
[state :as state]]
[saml20-clj.sp
[metadata :as metadata]
[request :as request]])
[saml20-clj.coerce :as coerce]
[saml20-clj.sp.metadata :as metadata]
[saml20-clj.sp.request :as request]
[saml20-clj.state :as state])
(:import java.net.URL
javax.security.cert.X509Certificate
org.opensaml.security.credential.Credential
Expand Down
5 changes: 2 additions & 3 deletions test/saml20_clj/coerce_test.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(ns saml20-clj.coerce-test
(:require [clojure.test :refer :all]
[saml20-clj
[coerce :as coerce]
[test :as test]]))
[saml20-clj.coerce :as coerce]
[saml20-clj.test :as test]))

(defn- key-fingerprint [^java.security.Key k]
(when k
Expand Down
9 changes: 4 additions & 5 deletions test/saml20_clj/crypto_test.clj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
(ns saml20-clj.crypto-test
(:require [clojure.test :refer :all]
[java-time :as t]
[saml20-clj
[coerce :as coerce]
[crypto :as crypto]
[test :as test]]
[saml20-clj.sp.request :as request]))
[saml20-clj.coerce :as coerce]
[saml20-clj.crypto :as crypto]
[saml20-clj.sp.request :as request]
[saml20-clj.test :as test]))

(deftest sign-request-test
(testing "Signature should be valid when signing request"
Expand Down
12 changes: 5 additions & 7 deletions test/saml20_clj/sp/request_test.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
(ns saml20-clj.sp.request-test
(:require [clojure
[string :as str]
[test :refer :all]]
(:require [clojure.string :as str]
[clojure.test :refer :all]
[java-time :as t]
[saml20-clj
[coerce :as coerce]
[test :as test]]
[saml20-clj.sp.request :as request]))
[saml20-clj.coerce :as coerce]
[saml20-clj.sp.request :as request]
[saml20-clj.test :as test]))

(def target-uri "http://sp.example.com/demo1/index.php?acs")

Expand Down
7 changes: 3 additions & 4 deletions test/saml20_clj/sp/response_test.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
(ns saml20-clj.sp.response-test
(:require [clojure.test :refer :all]
[java-time :as t]
[saml20-clj
[coerce :as coerce]
[test :as test]]
[saml20-clj.sp.response :as response])
[saml20-clj.coerce :as coerce]
[saml20-clj.sp.response :as response]
[saml20-clj.test :as test])
(:import org.opensaml.saml.saml2.core.Response))

(deftest response-status-test
Expand Down
10 changes: 4 additions & 6 deletions test/saml20_clj/state_test.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
(ns saml20-clj.state-test
(:require [clojure.test :refer :all]
[java-time :as t]
[saml20-clj
[coerce :as coerce]
[state :as state]]
[saml20-clj.sp
[request :as request]
[response :as response]]))
[saml20-clj.coerce :as coerce]
[saml20-clj.sp.request :as request]
[saml20-clj.sp.response :as response]
[saml20-clj.state :as state]))

(deftest in-memory-state-manager-test
(let [m (state/in-memory-state-manager)]
Expand Down

0 comments on commit 5e103a9

Please sign in to comment.