Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth2 Middleware integration #21

Closed
13 tasks done
threez opened this issue Aug 4, 2019 · 0 comments
Closed
13 tasks done

OAuth2 Middleware integration #21

threez opened this issue Aug 4, 2019 · 0 comments

Comments

@threez
Copy link
Contributor

threez commented Aug 4, 2019

  • Add a new integration test stage and add a -short flag to the current test stage
    • filter the tests in the integration suite using -run TestIntegration
  • Automatic configuration using environment variables, e.g.:
    import "github.com/caarlos0/env"
    
    type config struct {
    	URL    string `env:"OAUTH2_URL" envDefault:"`https://oauth.example.com`"`
    	Client string `env:"OAUTH2_CLIENT"`
    	Secret string `env:"OAUTH2_SECRET"`
    }
    
    func func NewMiddleware() *Middleware {
    	var cfg config
    	err := env.Parse(&cfg)
    	if err != nil {
    		log.Fatalf("Failed to parse postgres environment: %v", err)
    	}
    	return ....
    }
    The idea is, that we can 12-factor-app like create a new middleware which automatically takes the config from the environment.
  • Use the "lab.jamit.de/pace/go-microservice/maintenance/log" package for logging
  • Use ClientID in metrics https://github.com/pace/bricks/blob/master/maintenance/metrics/jsonapi/jsonapi.go#L60
    • Adopt tests (We (@vil and @why-el) elected to do this some other time by implementing a local Prometheus client to be used by the testserver).
  • Use ClientID and UserID in logs (the ClientID and UserID should be logged once for all requests. https://github.com/pace/bricks/blob/master/maintenance/log/handler.go#L28 UPDATE: Logging should be done in the router. The oauth2 will inject its own logging hander middleware.
    • Adopt tests
  • Add ClientID and UserID in traces (https://github.com/pace/bricks/blob/master/http/jsonapi/generator/generate_handler.go#L459-461) This will be reverted, see opentracing item below.
    • check that it works in Jaeger using the make testserver
  • document configuration for the oauth2 middleware via environment variables
  • Do opentracing from directly oauth2, since we want to capture the cockpit request.
    • check that it works in Jaeger using the make testserver
@threez threez closed this as completed Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant