github.com/avenga/couper@v1.12.2/server/testdata/oauth2/11_couper.hcl (about)

     1  server "oauth-client" {
     2  
     3    endpoint "/oauth1/redir" {
     4      access_control = ["ac-oauth-1"]
     5      response {
     6        json_body = request.context.ac-oauth-1
     7      }
     8    }
     9  
    10    endpoint "/oauth2/redir" {
    11      access_control = ["ac-oauth-2"]
    12      response {
    13        json_body = request.context.ac-oauth-2
    14      }
    15    }
    16  
    17    endpoint "/oidc1/redir" {
    18      access_control = ["ac-oidc-1"]
    19      response {
    20        json_body = request.context.ac-oidc-1
    21      }
    22    }
    23  
    24    endpoint "/oidc1.1/redir" {
    25      access_control = ["ac-oidc-1-1"]
    26      response {
    27        json_body = request.context.ac-oidc-1-1
    28      }
    29    }
    30  
    31    endpoint "/oidc2/redir" {
    32      access_control = ["ac-oidc-2"]
    33      response {
    34        json_body = request.context.ac-oidc-2
    35      }
    36    }
    37  }
    38  
    39  definitions {
    40    # with referenced backend
    41    beta_oauth2 "ac-oauth-1" {
    42      authorization_endpoint = "{{.asOrigin}}/auth"
    43      token_endpoint         = "{{.asOrigin}}/token"
    44      backend                = "token"
    45      client_id              = "foo"
    46      client_secret          = "etbinbp4in"
    47      grant_type             = "authorization_code"
    48      verifier_method        = "ccm_s256"
    49      verifier_value         = request.cookies.pkcecv
    50      redirect_uri           = "http://localhost:8080/oauth/redir"
    51    }
    52  
    53    # with inline backend
    54    beta_oauth2 "ac-oauth-2" {
    55      authorization_endpoint = "{{.asOrigin}}/auth"
    56      token_endpoint         = "{{.asOrigin}}/token"
    57      backend {
    58        origin = "{{.asOrigin}}"
    59        add_request_headers = {
    60          x-sub = "myself"
    61        }
    62      }
    63      client_id       = "foo"
    64      client_secret   = "etbinbp4in"
    65      grant_type      = "authorization_code"
    66      verifier_method = "ccm_s256"
    67      verifier_value  = request.cookies.pkcecv
    68      redirect_uri    = "http://localhost:8080/oauth/redir"
    69    }
    70  
    71    # with referenced backend
    72    oidc "ac-oidc-1" {
    73      configuration_url = "{{.asOrigin}}/.well-known/openid-configuration"
    74      configuration_ttl = "1h"
    75      backend           = "configuration" # base for configuration_backend, token_backend
    76      token_backend     = "token"
    77      client_id         = "foo"
    78      client_secret     = "etbinbp4in"
    79      verifier_method   = "ccm_s256"
    80      verifier_value    = request.cookies.pkcecv
    81      redirect_uri      = "http://localhost:8080/oidc/redir"
    82    }
    83    oidc "ac-oidc-1-1" {
    84      configuration_url = "{{.asOrigin}}/.well-known/openid-configuration"
    85      configuration_ttl = "1h"
    86      configuration_backend = "configuration"
    87      token_backend     = "token"
    88      userinfo_backend = "configuration"
    89      jwks_uri_backend = "configuration"
    90      client_id         = "foo"
    91      client_secret     = "etbinbp4in"
    92      verifier_method   = "ccm_s256"
    93      verifier_value    = request.cookies.pkcecv
    94      redirect_uri      = "http://localhost:8080/oidc/redir"
    95    }
    96  
    97    # with inline backend
    98    oidc "ac-oidc-2" {
    99      configuration_url = "{{.asOrigin}}/.well-known/openid-configuration"
   100      configuration_ttl = "1h"
   101      backend {
   102        origin = "{{.asOrigin}}"
   103        add_request_headers = {
   104          x-sub = "myself"
   105        }
   106      }
   107      client_id       = "foo"
   108      client_secret   = "etbinbp4in"
   109      verifier_method = "ccm_s256"
   110      verifier_value  = request.cookies.pkcecv
   111      redirect_uri    = "http://localhost:8080/oidc/redir"
   112    }
   113  
   114    # authorization server split by context for debugging purposes
   115    backend "configuration" {
   116      origin = "{{.asOrigin}}"
   117      add_request_headers = {
   118        x-sub = "myself"
   119      }
   120    }
   121  
   122    backend "token" {
   123      origin = "{{.asOrigin}}"
   124      add_request_headers = {
   125        x-sub = "myself"
   126      }
   127    }
   128  
   129  }
   130  
   131  settings {
   132    no_proxy_from_env = true
   133  }