-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (30 loc) · 956 Bytes
/
index.js
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
import { createAuthRequest } from './authrequest'
import { createLogoutRequestUrl } from './logoutrequest'
import { loadNIAMetadata } from './idp_metadata'
import { LOA, PROFILEATTRS } from './consts'
import { NIAError } from './utils'
import { loginPostAssert, logoutPostAssert } from './response'
export default class NIA {
//
constructor (options, testenv = false) {
this.opts = options
this.opts.notbefore_skew = 1
Object.assign(this.opts, loadNIAMetadata(Boolean(testenv)))
}
createAuthRequestUrl (loginOpts) {
return createAuthRequest(loginOpts, this.opts)
}
postAssert (body) {
return loginPostAssert(this.opts, body)
}
createLogoutRequestUrl (nameId, sessionIndex) {
return createLogoutRequestUrl(nameId, sessionIndex, this.opts)
}
logoutAssert (body) {
return logoutPostAssert(this.opts, body)
}
}
// static class consts
NIA.NIAError = NIAError
NIA.LOA = LOA
NIA.PROFILEATTRS = PROFILEATTRS