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

     1  server {
     2    hosts = ["*:8080"]
     3  
     4    api {
     5      endpoint "/anything" {
     6        proxy {
     7          backend = "oauth_rs_cc"
     8        }
     9      }
    10    }
    11  }
    12  
    13  definitions {
    14    backend "oauth_rs_cc" {
    15      origin = "https://httpbin.org"
    16  
    17      oauth2 {
    18        grant_type = "client_credentials"
    19        client_id = "clid1"
    20        client_secret = "cls1"
    21        token_endpoint = "http://localhost:8081/token"
    22        backend = "oauth_as1"
    23      }
    24    }
    25  
    26    backend "oauth_as1" {
    27      origin = "http://localhost:8081"
    28  
    29      oauth2 {
    30        grant_type = "client_credentials"
    31        client_id = "csid2"
    32        client_secret = "cls2"
    33        token_endpoint = "http://localhost:8082/token"
    34        backend = "oauth_as2"
    35      }
    36    }
    37    backend "oauth_as2" {
    38      origin = "http://localhost:8082"
    39    }
    40  }
    41  
    42  server "as1" {
    43    hosts = ["*:8081"]
    44  
    45    api {
    46      endpoint "/token" {
    47        response {
    48          json_body = {
    49            access_token = "foo-${unixtime()}"
    50            expires_in = 60
    51          }
    52        }
    53      }
    54    }
    55  }
    56  
    57  server "as2" {
    58    hosts = ["*:8082"]
    59  
    60    api {
    61      endpoint "/token" {
    62        response {
    63          json_body = {
    64            access_token = "lkjh"
    65            expires_in = "1h"
    66          }
    67        }
    68      }
    69    }
    70  }