Make template use DeviceId for now

This commit is contained in:
Herman Slatman 2024-01-10 17:08:29 +01:00
parent 7a464cdb17
commit e2a2e00526
No known key found for this signature in database
GPG Key ID: F4D8A44EA0A75A4F
2 changed files with 4 additions and 4 deletions

View File

@ -43,12 +43,12 @@ func (o *DPOPOptions) GetTarget(deviceID string) (string, error) {
return "", errors.New("misconfigured target template configuration") return "", errors.New("misconfigured target template configuration")
} }
targetTemplate := o.GetDPOPTarget() targetTemplate := o.GetDPOPTarget()
tmpl, err := template.New("DeviceID").Parse(targetTemplate) tmpl, err := template.New("DeviceId").Parse(targetTemplate)
if err != nil { if err != nil {
return "", fmt.Errorf("failed parsing dpop template: %w", err) return "", fmt.Errorf("failed parsing dpop template: %w", err)
} }
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
if err = tmpl.Execute(buf, struct{ DeviceID string }{DeviceID: deviceID}); err != nil { if err = tmpl.Execute(buf, struct{ DeviceId string }{DeviceId: deviceID}); err != nil {
return "", fmt.Errorf("failed executing dpop template: %w", err) return "", fmt.Errorf("failed executing dpop template: %w", err)
} }
return buf.String(), nil return buf.String(), nil

View File

@ -56,12 +56,12 @@ func (o *OIDCOptions) GetTarget(deviceID string) (string, error) {
return "", errors.New("misconfigured target template configuration") return "", errors.New("misconfigured target template configuration")
} }
targetTemplate := o.Provider.IssuerURL targetTemplate := o.Provider.IssuerURL
tmpl, err := template.New("DeviceID").Parse(targetTemplate) tmpl, err := template.New("DeviceId").Parse(targetTemplate)
if err != nil { if err != nil {
return "", fmt.Errorf("failed parsing oidc template: %w", err) return "", fmt.Errorf("failed parsing oidc template: %w", err)
} }
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
if err = tmpl.Execute(buf, struct{ DeviceID string }{DeviceID: deviceID}); err != nil { if err = tmpl.Execute(buf, struct{ DeviceId string }{DeviceId: deviceID}); err != nil {
return "", fmt.Errorf("failed executing oidc template: %w", err) return "", fmt.Errorf("failed executing oidc template: %w", err)
} }
return buf.String(), nil return buf.String(), nil