Require admin to create users
This commit is contained in:
parent
9625b23033
commit
a6be7e929a
@ -1,4 +1,5 @@
|
||||
FROM golang:alpine as build
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /app
|
||||
COPY go.sum /app/go.sum
|
||||
COPY go.mod /app/go.mod
|
||||
|
2
go.mod
2
go.mod
@ -11,6 +11,8 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
git.t-juice.club/microfilm/auth v0.1.1 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
|
||||
github.com/klauspost/compress v1.17.0 // indirect
|
||||
github.com/nats-io/nkeys v0.4.5 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"git.t-juice.club/microfilm/auth"
|
||||
"git.t-juice.club/microfilm/auth/authmw"
|
||||
"git.t-juice.club/microfilm/users"
|
||||
"git.t-juice.club/microfilm/users/store"
|
||||
"github.com/go-chi/chi/v5"
|
||||
@ -34,8 +36,10 @@ func NewServer(config *Config) (*UserServer, error) {
|
||||
|
||||
r.Use(srv.MiddlewareLogging)
|
||||
|
||||
verifyAdmin := authmw.VerifyToken("http://mf-auth:8082", []string{auth.RoleAdmin})
|
||||
|
||||
r.Get("/info", InfoHandler)
|
||||
r.Post("/", srv.CreateUserHandler)
|
||||
r.With(verifyAdmin).Post("/", srv.CreateUserHandler)
|
||||
r.Post("/{identifier}/password", srv.SetPasswordHandler)
|
||||
r.Post("/{identifier}/verify", srv.VerifyHandler)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user