canonical / identity-platform-admin-ui

Admin UI for the Canonical identity broker and identity provider solution
Other
6 stars 4 forks source link

IAM-655 - authz/middleware #190

Closed shipperizer closed 6 months ago

shipperizer commented 6 months ago

IAM-655: first iteration on the authorization middleware

code relies on the model defined in the spec ID-034

to be plugged as middleware, please use the With directive, not Use due to how the URLParam function operates

    middlewares := make(chi.Middlewares, 0)
    middlewares = append(
        middlewares,
        middleware.RequestID,
        middleware.RequestLogger(logging.NewLogFormatter(logger)), // LogFormatter will only work if logger is set to DEBUG level,

    )

    router.Use(middlewares...)

        chiMux := router.With(authMdw).(*chi.Mux)
    roles.NewAPI(roles.NewService(ofga, tracer, monitor, logger), tracer, monitor, logger).RegisterEndpoints(chiMux)

Changes