-
-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathtypes.ts
More file actions
135 lines (117 loc) · 3.88 KB
/
types.ts
File metadata and controls
135 lines (117 loc) · 3.88 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import { LoginResponseTemplate } from './libsaml';
export { IdentityProvider as IdentityProviderConstructor } from './entity-idp';
export { IdpMetadata as IdentityProviderMetadata } from './metadata-idp';
export { ServiceProvider as ServiceProviderConstructor } from './entity-sp';
export { SpMetadata as ServiceProviderMetadata } from './metadata-sp';
export type MetadataFile = string | Buffer;
type SSOService = {
isDefault?: boolean;
Binding: string;
Location: string;
};
interface MetadataOptions {
entityID?: string;
signingCert?: string | Buffer | (string | Buffer)[];
encryptCert?: string | Buffer | (string | Buffer)[];
nameIDFormat?: string[];
singleSignOnService?: SSOService[];
singleLogoutService?: SSOService[];
elementsOrder?: string[];
customAttributes?: {
_attr?: Record<string, string>,
name?: string,
value?: string
}[]
}
export interface MetadataIdpOptions extends MetadataOptions {
wantAuthnRequestsSigned?: boolean;
requestSignatureAlgorithm?: string;
organization?: {
name?: string,
displayName?: string,
url?: string
},
technicalContact?: { name: string, email: string },
supportContact?: { name: string, email: string },
}
export type MetadataIdpConstructor =
| MetadataIdpOptions
| MetadataFile;
export interface MetadataSpOptions extends MetadataOptions {
authnRequestsSigned?: boolean;
wantAssertionsSigned?: boolean;
wantMessageSigned?: boolean;
signatureConfig?: { [key: string]: any };
assertionConsumerService?: SSOService[];
}
export type MetadataSpConstructor =
| MetadataSpOptions
| MetadataFile;
export type EntitySetting = ServiceProviderSettings & IdentityProviderSettings;
export interface SignatureConfig {
prefix?: string;
location?: {
reference?: string;
action?: 'append' | 'prepend' | 'before' | 'after';
};
}
export interface SAMLDocumentTemplate {
context?: string;
}
export type ServiceProviderSettings = {
metadata?: string | Buffer;
entityID?: string;
authnRequestsSigned?: boolean;
wantAssertionsSigned?: boolean;
wantMessageSigned?: boolean;
wantLogoutResponseSigned?: boolean;
wantLogoutRequestSigned?: boolean;
privateKey?: string | Buffer;
privateKeyPass?: string;
isAssertionEncrypted?: boolean;
requestSignatureAlgorithm?: string;
encPrivateKey?: string | Buffer;
encPrivateKeyPass?: string | Buffer;
assertionConsumerService?: SSOService[];
singleLogoutService?: SSOService[];
signatureConfig?: SignatureConfig;
loginRequestTemplate?: SAMLDocumentTemplate;
logoutRequestTemplate?: SAMLDocumentTemplate;
signingCert?: string | Buffer | (string | Buffer)[];
encryptCert?: string | Buffer | (string | Buffer)[];
transformationAlgorithms?: string[];
nameIDFormat?: string[];
allowCreate?: boolean;
// will be deprecated soon
relayState?: string;
// https://github.com/tngan/samlify/issues/337
clockDrifts?: [number, number];
};
export type IdentityProviderSettings = {
metadata?: string | Buffer;
/** signature algorithm */
requestSignatureAlgorithm?: string;
/** template of login response */
loginResponseTemplate?: LoginResponseTemplate;
/** template of logout request */
logoutRequestTemplate?: SAMLDocumentTemplate;
/** customized function used for generating request ID */
generateID?: () => string;
entityID?: string;
privateKey?: string | Buffer;
privateKeyPass?: string;
signingCert?: string | Buffer | (string | Buffer)[];
encryptCert?: string | Buffer | (string | Buffer)[];
nameIDFormat?: string[];
singleSignOnService?: SSOService[];
singleLogoutService?: SSOService[];
isAssertionEncrypted?: boolean;
encPrivateKey?: string | Buffer;
encPrivateKeyPass?: string;
messageSigningOrder?: string;
wantLogoutRequestSigned?: boolean;
wantLogoutResponseSigned?: boolean;
wantAuthnRequestsSigned?: boolean;
wantLogoutRequestSignedResponseSigned?: boolean;
tagPrefix?: { [key: string]: string };
};