-
Notifications
You must be signed in to change notification settings - Fork 4
/
challenge.clj
72 lines (60 loc) · 1.77 KB
/
challenge.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(ns happygapi.verifiedaccess.challenge
"Verified Access API: challenge.
API for Verified Access chrome extension to provide credential verification for chrome devices connecting to an enterprise network
See: https://www.google.com/work/chrome/api/reference/rest/v1/challenge"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn verify$
"https://www.google.com/work/chrome/api/reference/rest/v1/challenge/verify
Required parameters: none
Optional parameters: none
Body:
{:challengeResponse {:signature string, :data string},
:expectedIdentity string}
VerifyChallengeResponse API"
{:scopes ["https://www.googleapis.com/auth/verifiedaccess"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://verifiedaccess.googleapis.com/"
"v1/challenge:verify"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn create$
"https://www.google.com/work/chrome/api/reference/rest/v1/challenge/create
Required parameters: none
Optional parameters: none
Body:
{}
CreateChallenge API"
{:scopes ["https://www.googleapis.com/auth/verifiedaccess"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://verifiedaccess.googleapis.com/"
"v1/challenge"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))