hscontrol, cli: add auth register and approve commands
Implement AuthRegister and AuthApprove gRPC handlers and add corresponding CLI commands (headscale auth register, approve, reject) for managing pending auth requests including SSH check approvals. Updates #1850
This commit is contained in:
parent
61a14bb0e4
commit
48cc98b787
4 changed files with 153 additions and 4 deletions
|
|
@ -282,7 +282,7 @@ func (a *AuthProviderWeb) AuthHandler(
|
|||
}
|
||||
|
||||
func authIDFromRequest(req *http.Request) (types.AuthID, error) {
|
||||
registrationId, err := urlParam[types.AuthID](req, "auth_id")
|
||||
raw, err := urlParam[string](req, "auth_id")
|
||||
if err != nil {
|
||||
return "", NewHTTPError(http.StatusBadRequest, "invalid registration id", fmt.Errorf("parsing auth_id from URL: %w", err))
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ func authIDFromRequest(req *http.Request) (types.AuthID, error) {
|
|||
// We need to make sure we dont open for XSS style injections, if the parameter that
|
||||
// is passed as a key is not parsable/validated as a NodePublic key, then fail to render
|
||||
// the template and log an error.
|
||||
err = registrationId.Validate()
|
||||
registrationId, err := types.AuthIDFromString(raw)
|
||||
if err != nil {
|
||||
return "", NewHTTPError(http.StatusBadRequest, "invalid registration id", fmt.Errorf("parsing auth_id from URL: %w", err))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue