Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cemerick/friend
base: master
...
head fork: mccraigmccraig/friend
compare: skip_redirect_after_interactive_form_auth
Checking mergeability… Don't worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
4 project.clj
@@ -1,4 +1,4 @@
-(defproject com.cemerick/friend "0.0.3"
+(defproject org.clojars.mccraigmccraig/friend "0.0.4-SNAPSHOT"
:description "Authentication and authorization library for Ring Clojure web apps and services."
:url "http://github.com/cemerick/friend"
:license {:name "Eclipse Public License"
@@ -17,7 +17,7 @@
[org.openid4java/openid4java-consumer "0.9.6" :extension "pom"]
; need different httpclient rev for https://issues.apache.org/jira/browse/HTTPCLIENT-1118
[org.apache.httpcomponents/httpclient "4.2-beta1"]]
-
+
:profiles {:dev {:dependencies [[ring-mock "0.1.1"]
[compojure "1.0.1"]
[ring "1.0.2"]
View
7 src/cemerick/friend/workflows.clj
@@ -50,7 +50,8 @@
param))))
(defn interactive-form
- [& {:keys [login-uri credential-fn login-failure-handler] :as form-config}]
+ [& {:keys [login-uri credential-fn login-failure-handler redirect-on-auth?] :as form-config
+ :or {redirect-on-auth? true}}]
(fn [{:keys [uri request-method params] :as request}]
(when (and (= login-uri uri)
(= :post request-method))
@@ -60,7 +61,7 @@
(with-meta creds {::friend/workflow :interactive-form})))]
(with-meta (username-as-identity user-record)
{::friend/workflow :interactive-form
- :type ::friend/auth})
+ :type ::friend/auth
+ ::friend/redirect-on-auth? redirect-on-auth?})
((or (gets :login-failure-handler form-config (::friend/auth-config request)) #'interactive-login-redirect)
(update-in request [::friend/auth-config] merge form-config)))))))
-
View
11 test/test_friend/interactive_form.clj
@@ -15,21 +15,22 @@
(= "Aladdin" username))
{:identity username})))]
(is (nil? (form-handler (request :get login-uri))))
-
+
(is (= {:status 302
:headers {"Location" "/my_login?&login_failed=Y&username="}
:body ""}
(form-handler (request :post login-uri))))
-
+
(is (= {:status 302
:headers {"Location" "/my_login?&login_failed=Y&username=foo"}
:body ""}
(form-handler (assoc (request :post login-uri)
:params {:username "foo"}))))
-
+
(let [auth (form-handler (assoc (request :post login-uri)
:params {:username "Aladdin"
- :password "open sesame"}))]
+ :password "open sesame"}))]
(is (= auth {:identity "Aladdin"}))
(is (= (meta auth) {::friend/workflow :interactive-form
- :type ::friend/auth})))))
+ :type ::friend/auth
+ ::friend/redirect-on-auth? true})))))

No commit comments for this range

Something went wrong with that request. Please try again.