mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-24 13:38:17 +02:00
authenticate: fix expiring user info endpoint (#2976)
* authenticate: fix expiring user info endpoint * add test
This commit is contained in:
parent
fbdbe9c86f
commit
2f328e7de0
4 changed files with 122 additions and 37 deletions
|
@ -16,7 +16,6 @@ import (
|
|||
"github.com/pomerium/pomerium/internal/log"
|
||||
"github.com/pomerium/pomerium/internal/urlutil"
|
||||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
"github.com/pomerium/pomerium/pkg/webauthnutil"
|
||||
)
|
||||
|
||||
// ValidateOptions checks that configuration are complete and valid.
|
||||
|
@ -125,25 +124,6 @@ func (a *Authenticate) updateProvider(cfg *config.Config) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *Authenticate) getWebAuthnURL(values url.Values) (*url.URL, error) {
|
||||
uri, err := a.options.Load().GetAuthenticateURL()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
uri = uri.ResolveReference(&url.URL{
|
||||
Path: "/.pomerium/webauthn",
|
||||
RawQuery: buildURLValues(values, url.Values{
|
||||
urlutil.QueryDeviceType: {webauthnutil.DefaultDeviceType},
|
||||
urlutil.QueryEnrollmentToken: nil,
|
||||
urlutil.QueryRedirectURI: {uri.ResolveReference(&url.URL{
|
||||
Path: "/.pomerium/device-enrolled",
|
||||
}).String()},
|
||||
}).Encode(),
|
||||
})
|
||||
return urlutil.NewSignedURL(a.state.Load().sharedKey, uri).Sign(), nil
|
||||
}
|
||||
|
||||
// buildURLValues creates a new url.Values map by traversing the keys in `defaults` and using the values
|
||||
// from `values` if they exist, otherwise the provided defaults
|
||||
func buildURLValues(values, defaults url.Values) url.Values {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue