info:
  name: Generate Access Token
  type: http
  seq: 3

http:
  method: POST
  url: "{{shibbolethServerUri}}/idp/profile/oidc/token"
  headers:
    - name: Content-Type
      value: application/x-www-form-urlencoded
  body:
    type: form-urlencoded
    data:
      - name: grant_type
        value: authorization_code
      - name: redirect_uri
        value: "{{clientRedirectUri}}"
      - name: scope
        value: openid profile email
      - name: code
        value: AAdzZWNyZXQxcKlGLY3zJzZp-SXBg9tSJp2n8PxhgB5nnYFr1f50GfD69sLo_OZ3t73WEPW2BKhY5sGh6A-dEmu7nX_PCk0QU7UwZEkFTQPu28BPyE11r-aqAZEO88CN0bTZB5nzx8ecAcQMvE8X74rHpmiWDf2YKdQVPlb9N7ON_ALKWx1XmVueinmHiwXFow1hnhZMxZK_Jy0DSmT9QN4pbfyDD2UkRZo4BOgyxqlYiDWWGF39DkVdwJfrduq5HM3yT3bUdR2zB-u25ol6NrOpfkoaM5-QKWexCfmFLx_huZah4vXY0RnvdzE8v5fpLCYVDUwv3gSXpsOuS4Ynf84Wz8Nr6bdaCo8hfHdCvNDtNPEBy7DTQ-2rb3Lgqq_piqj3N9WpBFIqqRQfwHBnKGGr07TXoaEi_fSROZ99VIJaPVJZNTdCNiiR9Sql_78KJr1tapx9eQD2UnkRPlzpBvQU6W4uX4YHqgd0i9sLEBOFv4BkGc9AwpB5ew
        description: Paste code obtained by manual flow in browser
  auth:
    type: basic
    username: "{{clientId}}"
    password: "{{clientSecret}}"

runtime:
  scripts:
    - type: after-response
      code: |-
        var jsonData = res.getBody();
        bru.setVar("accessToken", jsonData.access_token);
    - type: tests
      code: |-
        test("Status code is 200", function () {
            expect(res.getStatus()).to.equal(200);
        });

settings:
  encodeUrl: true
  timeout: 0
  followRedirects: true
  maxRedirects: 5
  forwardAuthorizationHeader: true

examples:
  - name: Token data
    request:
      url: https://shibidp.unipr.it/idp/profile/oidc/token
      method: POST
      headers:
        - name: Content-Type
          value: application/x-www-form-urlencoded
      params:
        - name: client_id
          value: "{{shibbolethClientId}}"
          type: query
          disabled: true
        - name: client_secret
          value: "{{shibbolethClientSecret}}"
          type: query
          disabled: true
        - name: grant_type
          value: code
          type: query
          disabled: true
        - name: scope
          value: openid
          type: query
          disabled: true
        - name: code
          value: AAdzZWNyZXQxkZu_xOleOZj6LkAn2Il3wl2T_AnIqKZ2rujs1eC6vS3QEi_Xk5cgedRG5tD9UYDN7YDBWfudDOW_mgkCjtXk4V8dCDJAU0G3mAThwV3yUhBsv1ljnZ
          type: query
          disabled: true
      body:
        type: form-urlencoded
        data:
          - name: grant_type
            value: authorization_code
          - name: redirect_uri
            value: https://gitea.unipr.it/user/oauth2/Shibboleth/callback
          - name: scope
            value: openid profile email
          - name: code
            value: AAdzZWNyZXQx1CToBgEqA8mxMWGsLKf0V86PS2Oz-3bI5BlRuiitj3iXP_qfSJgNzYsMdsIQ9QRmoIOS6ISVvFSyJ5XeHYE_msw6VJELg9S6qsO4mrBBwCaUM9p3zMPwNBwZJVn6vqgGghpMS_xeW2EGthh9W0HBsh7WuPYK4HJVpTYIxgYR782xET0ZU3XxLBknOeMoye2IrH3sYpeCRQCmd1GUyTl1Ra4sGdqYcw3iiISA_FbPMXOLFQN8GcFtEcPxzc9CtH4PHKDYIj_QQx0IUgEH814pyC-Oc5-19Gfg4Ulps9ZHF9rb4csbi9mvWAuJESHcSp5NSAK9tEMFvBUCe_2nr7WyzaGTI1D6Nr1PenxbWIRAmXGF5LtzSrv-8_k8XSdufefACBVbZH6EQWm4smrqSlMab71F5s9wB3rFEK5IuANQblFljG_vfoCATpmk0MCYo47SApSrorMYN5K6yWf4P3PuyQrIdrw0PsRzBWoY8XpzQTGYN1I
    response:
      status: 200
      statusText: OK
      headers:
        - name: date
          value: Wed, 19 Aug 2026 08:57:29 GMT
        - name: server
          value: Jetty(11.0.19)
        - name: strict-transport-security
          value: max-age=63072000; includeSubDomains, max-age=63072000 ; includeSubDomains ; preload
        - name: x-content-type-options
          value: nosniff
        - name: x-frame-options
          value: SAMEORIGIN, DENY
        - name: cache-control
          value: no-store, no-store
        - name: content-type
          value: application/json;charset=utf-8
        - name: pragma
          value: no-cache
        - name: content-security-policy
          value: frame-ancestors 'none'; base-uri 'none'; script-src 'self' https://shibidp.unipr.it 'unsafe-inline';
        - name: keep-alive
          value: timeout=2, max=100
        - name: connection
          value: Keep-Alive
        - name: transfer-encoding
          value: chunked
      body:
        type: json
        data: |-
          {
            "access_token": "AAdzZWNyZXQxO7PLpDizfp4m1e9ERj9_wLc2HaUQ-TtcgcG-CMvVU7D2BbfPpk1uosrMzlMXEy7SCfcrMKExh-w7xc6u4dL4M8Zz0eoZTZmPB59RhV456tGlYIV3fsxShWJzgdr2QvUdap-GVB5cWzPPaXKdBlzn_5lJfeCcoZwTdIEr6ndwNF7iuDyQ4YNbechW31Y9pD8xZYmlrtNqCfQIVkziG136n6UyMurzw1V6s3zuGQ0YXTL7E4hpjk66J7gU3hlkIM9InH9riWRgADUHvaTBdjQcq9TWWuf7-ckcy-MbHJH0_ZuAkYoKTGuXEWhchCdyJeDCZuKDiazko3C9RYQOWQqaFp5ney9Ox7sG_ZjCNY-TNvpT7YmeOm_8lTGTGSnd4lumPIHiRlwSG_8IEa06SRg4rnz9kudM0Hnto2VsgZ4PtImQlGC3H8Zbw60Jrwvxw_fvxRkXeBOx5IdElMRKhvsRogA8me6-gSVIl8Q",
            "scope": "openid profile email",
            "id_token": "eyJraWQiOiJkZWZhdWx0UlNBU2lnbiIsImFsZyI6IlJTMjU2In0.eyJhdF9oYXNoIjoieTdUSjczeDNsbDF0ZEI5bU96RmtQUSIsInN1YiI6ImIwYTUwMmY2YWQ5MDQyN2YxZTZjYTdjODVhNzZjY2NiOGI5MzVhZjRkMjc1MDQyMTFhMDQwMGI0MmY5MGMxNDFAdW5pcHIuaXQiLCJhdWQiOiJvaWRjX2dpdGVhXzAxIiwiYXV0aF90aW1lIjoxNzg3MTI5ODQyLCJpc3MiOiJodHRwczovL3NoaWJpZHAudW5pcHIuaXQiLCJleHAiOjE3ODcxMzM0NDksImlhdCI6MTc4NzEyOTg0OSwic2lkIjoiX2UwMWJiZDkwMzQ5ODMzNDNkM2U0MmE5OTU5NDIyYmUzIn0.k5AQaood5q4ynRmYgC20cFV7cpBVrLwFC6Bi05PGvWFmnu5_u3nI4yAngM-u3qe7ILiJnsYsFuo3UUMowoJkycX5PveAo1x239_vK6Opp8VTQuCF4H8h4OmBjXj0eeCEQ3W00TUgV6S4rHU5NEvwiGR9ivEjZvVf1y2dzral7_DgX1KOQq5ZH5wma2Y5zM4el02pGEnPmi3P1zOXp1AQDx69cpZQj5UkKc15L8Y1yaJILMIDbsXgimSx1FGs_XA9bjSHdV2V25_h3TqsUxElwvb1uVk_kUqj06rDgORpnS_7Hg778GtW8kYZCz2kIYpYWi1h3tHhNnBOtHjxqepGyQ",
            "token_type": "Bearer",
            "expires_in": 600
          }
