generated from matoszz/mitbgo-template
-
Notifications
You must be signed in to change notification settings - Fork 7
/
authenticate.go
34 lines (28 loc) · 1.3 KB
/
authenticate.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
package route
import (
"net/http"
echo "github.com/datumforge/echox"
"github.com/datumforge/datum/internal/httpserve/handlers"
)
// Authenticate is oriented to machine users/ programmatic access that have an API key with a client ID and
// secret for authentication (whereas login is used for human access using an email and
// password). Authenticate verifies the client secret submitted is correct by looking
// up the api key by the key ID and using the argon2 derived key verification process
// to confirm the secret matches. Upon authentication, an access and refresh token with
// the authorized claims of the keys are returned. These tokens can be used to
// authenticate with datum systems and the claims used for authorization. The access
// and refresh tokens work the same way the user tokens work and the refresh token can
// be used to fetch a new key pair without having to transmit a secret again.
// TODO: implement authenticate handler
func registerAuthenticateHandler(router *echo.Echo, h *handlers.Handler) (err error) { //nolint:unused
_, err = router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/authenticate",
Handler: func(c echo.Context) error {
return c.JSON(http.StatusNotImplemented, echo.Map{
"error": "Not implemented",
})
},
}.ForGroup(V1Version, mw))
return
}