/
types.go
92 lines (79 loc) · 2.34 KB
/
types.go
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
package templates
import (
th "html/template"
"io"
tt "text/template"
)
// Templates is the struct which holds all the *template.Template values.
type Templates struct {
notification NotificationTemplates
asset AssetTemplates
oidc OpenIDConnectTemplates
}
type OpenIDConnectTemplates struct {
formpost *th.Template
}
// AssetTemplates are templates for specific key assets.
type AssetTemplates struct {
index *tt.Template
api OpenAPIAssetTemplates
}
// OpenAPIAssetTemplates are asset templates for the OpenAPI specification.
type OpenAPIAssetTemplates struct {
index *tt.Template
spec *tt.Template
}
// NotificationTemplates are the templates for the notification system.
type NotificationTemplates struct {
jwtIdentityVerification *EmailTemplate
otcIdentityVerification *EmailTemplate
event *EmailTemplate
}
// Template covers shared implementations between the text and html template.Template.
type Template interface {
Execute(wr io.Writer, data any) error
ExecuteTemplate(wr io.Writer, name string, data any) error
Name() string
DefinedTemplates() string
}
// Config for the Provider.
type Config struct {
EmailTemplatesPath string
}
// EmailTemplate is the template type which contains both the html and txt versions of a template.
type EmailTemplate struct {
HTML *th.Template
Text *tt.Template
}
// EmailEventValues are the values used for event templates.
type EmailEventValues struct {
Title string
DisplayName string
Details map[string]any
RemoteIP string
}
// EmailPasswordResetValues are the values used for password reset templates.
type EmailPasswordResetValues struct {
Title string
DisplayName string
RemoteIP string
}
// EmailIdentityVerificationJWTValues are the values used for the identity verification JWT templates.
type EmailIdentityVerificationJWTValues struct {
Title string
DisplayName string
RemoteIP string
LinkURL string
LinkText string
RevocationLinkURL string
RevocationLinkText string
}
// EmailIdentityVerificationOTCValues are the values used for the identity verification OTP templates.
type EmailIdentityVerificationOTCValues struct {
Title string
DisplayName string
RemoteIP string
OneTimeCode string
RevocationLinkURL string
RevocationLinkText string
}