Skip to content

Conversation

buger
Copy link
Member

@buger buger commented Oct 7, 2025

User description

Add a Note on the availability of ctx.GetSession(r) in the middleware chain (#6959)


PR Type

Documentation


Description

  • Warn about session availability timing

  • Clarify ctx.GetSession in auth plugins

  • Add note block to Go plugins doc


Diagram Walkthrough

flowchart LR
  PreAuth["Custom auth plugin"] -- "ctx.GetSession => empty" --> AuthLayer["Authentication layer"]
  AuthLayer -- "sets session" --> PostAuth["Post-auth middleware"]
  PostAuth -- "ctx.GetSession => valid" --> Handlers["Downstream handlers"]
Loading

File Walkthrough

Relevant files
Documentation
golang.md
Add session timing warning for Go plugins                               

tyk-docs/content/api-management/plugins/golang.md

  • Add warning note shortcode block.
  • Explain session set during authentication layer.
  • Clarify ctx.GetSession returns empty in custom auth.
+7/-0     

@buger buger enabled auto-merge (squash) October 7, 2025 13:55
Copy link
Contributor

github-actions bot commented Oct 7, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix shortcode to render warning

The Hugo shortcode used is likely note with a type parameter rather than note
warning. Use {{< note type="warning" >}} to avoid render failures. Also, add
trailing punctuation to the note for clarity.

tyk-docs/content/api-management/plugins/golang.md [521-527]

-{{< note warning >}}
-**Note**  
+{{< note type="warning" >}}
+**Note:**  
 
 Tyk Gateway sets the session in the [Authentication layer]({{< ref "api-management/traffic-transformation#request-middleware-chain" >}}) of the middleware chain. Because of this, the session object does not exist until the middleware chain runs after the authentication middleware. If you call `ctx.GetSession` inside a custom auth plugin, it will always return an empty object.
 
 {{< /note >}}
Suggestion importance[1-10]: 3

__

Why: The suggestion proposes changing a Hugo shortcode syntax ({{< note warning >}} to {{< note type="warning" >}}) which may or may not be correct depending on the site's shortcode implementation; it's speculative and not derived from the diff context. It addresses a minor formatting concern, not functionality, though the existing_code snippet correctly matches the new hunk lines.

Low

Copy link

netlify bot commented Oct 7, 2025

PS. Add to the end of url /docs/nightly

Name Link
🔨 Latest commit 9a3e5e3
🔍 Latest deploy log https://app.netlify.com/projects/tyk-docs/deploys/68e51bc16c8c680008535033
😎 Deploy Preview https://deploy-preview-7007--tyk-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

1 similar comment
Copy link

netlify bot commented Oct 7, 2025

PS. Add to the end of url /docs/nightly

Name Link
🔨 Latest commit 9a3e5e3
🔍 Latest deploy log https://app.netlify.com/projects/tyk-docs/deploys/68e51bc16c8c680008535033
😎 Deploy Preview https://deploy-preview-7007--tyk-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@buger buger merged commit e6793f7 into release-5.8 Oct 7, 2025
11 checks passed
@buger buger deleted the merge/release-5.8/01bbb8a0f2cd7feac7cc73959780e9f9a4dec8e3 branch October 7, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants