notes/cisco_ft_securex_registration.org
This commit is contained in:
parent
b928717fdf
commit
6cccb96529
1 changed files with 35 additions and 0 deletions
|
@ -327,8 +327,43 @@ Accept: application/json
|
|||
Content-Type: application/json
|
||||
User-Agent: ob-http
|
||||
Authorization: Bearer ${user-identity-jwt}
|
||||
|
||||
|
||||
|
||||
#+end_src
|
||||
|
||||
#+begin_src clojure
|
||||
(s/defschema NewAccount
|
||||
(st/merge
|
||||
{org-name :- s/Str
|
||||
country :- (apply s/enum country-iso-codes)
|
||||
(st/optional-keys
|
||||
{:department :- s/Str
|
||||
:street1 :- s/Str
|
||||
:street2 :- s/Str
|
||||
:postal-code :- s/Str
|
||||
:city :- s/Str})}))
|
||||
|
||||
(POST
|
||||
"/create-new-account" []
|
||||
:summary "Given a code and some org-settings create a new account (new org and new user)"
|
||||
:description "This is an internal temporary route needed to select the user/org."
|
||||
:body [new-account NewAccount]
|
||||
(let [address (iroh-core/assoc-some?
|
||||
{:country-iso-code country}
|
||||
:department department
|
||||
:street1 street1
|
||||
:street2 street2
|
||||
:postal-code postal-code
|
||||
:city city)
|
||||
org-settings {:name org-name
|
||||
:address address}]
|
||||
(if-let [{:keys [origin] created-code :code}
|
||||
(create-new-account code org-settings)]
|
||||
(resp/found (url/append-query-to-url origin {:code created-code}))
|
||||
(resp/unauthorized!
|
||||
:login_error "Login Refused: Could not retrieve the code, maybe it was already used."))))
|
||||
#+end_src
|
||||
|
||||
**** List Matching Accounts
|
||||
|
||||
|
|
Loading…
Reference in a new issue