Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

docs for `throw-unauthorized`

  • Loading branch information...
1 parent 3a7d56a commit 2707c7da2a350c4851dc7bbabe6724f3a48b1a89 @cemerick committed
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/cemerick/friend.clj
17 src/cemerick/friend.clj
@@ -206,11 +206,20 @@ Equivalent to (complement current-authentication)."}
; keeping authenticate* separate is damn handy for debugging hooks, etc.
#(authenticate* ring-handler auth-config %))
-;; TODO
-#_(defmacro role-case
- [])
(defn throw-unauthorized
+ "Throws a slingshot stone (see `slingshot.slingshot/throw+`) containing
+ the [authorization-info] map, in addition to these slots:
+ :cemerick.friend/type - the type of authorization failure that has
+ occurred, defaults to `:unauthorized`
+ :cemerick.friend/identity - the current identity, defaults to the
+ provided [identity] argument
+ Provided the stone is thrown within the context of an `authenticate`
+ middleware, handling of the original request will be delegated to its
+ `unauthorized-handler` or the `unauthenticated-handler` as appropriate,
+ with the slingshot stone's map assoc'ed into the request map under
+ `:cemerick.friend/authorization-failure`."
[identity authorization-info]
(throw+ (merge {::type :unauthorized
::identity identity}

0 comments on commit 2707c7d

Please sign in to comment.
Something went wrong with that request. Please try again.