OAuth2

  • v3 API reference

  • This filter should be configured with the name envoy.filters.http.oauth2.

Attention

The OAuth2 filter is currently under active development.

Example configuration

  1. http_filters:
  2. - name: oauth2
  3. typed_config:
  4. "@type": type.googleapis.com/envoy.extensions.filters.http.oauth2.v3alpha.OAuth2
  5. token_endpoint:
  6. cluster: oauth
  7. uri: oauth.com/token
  8. timeout: 3s
  9. authorization_endpoint: https://oauth.com/oauth/authorize/
  10. redirect_uri: "%REQ(:x-forwarded-proto)%://%REQ(:authority)%/callback"
  11. redirect_path_matcher:
  12. path:
  13. exact: /callback
  14. signout_path:
  15. path:
  16. exact: /signout
  17. credentials:
  18. client_id: foo
  19. token_secret:
  20. name: token
  21. hmac_secret:
  22. name: hmac
  23. timeout: 3s
  24. - name: envoy.router
  25. clusters:
  26. - name: service
  27. ...
  28. - name: auth
  29. connect_timeout: 5s
  30. type: LOGICAL_DNS
  31. lb_policy: ROUND_ROBIN
  32. load_assignment:
  33. cluster_name: auth
  34. endpoints:
  35. - lb_endpoints:
  36. - endpoint:
  37. address: { socket_address: { address: auth.example.com, port_value: 443 }}
  38. tls_context: { sni: auth.example.com }

Notes

This module does not currently provide much Cross-Site-Request-Forgery protection for the redirect loop to the OAuth server and back.

The service must be served over HTTPS for this filter to work, as the cookies use ;secure.

Statistics

The OAuth filter outputs statistics in the <stat_prefix>. namespace.

Name

Type

Description

oauth_failure

Counter

Total requests that were denied.

oauth_success

Counter

Total requests that were allowed.

oauth_unauthorization_rq

Counter

Total unauthorized requests.