Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update portainer oidc config #8470

Merged

Conversation

leedotpang
Copy link
Contributor

@leedotpang leedotpang commented Dec 17, 2024

While implementing the OIDC config from the docs I ran in to the below error and was able to quickly fix it by updating the token_endpoint_auth_method explained in the error.

time="2024-12-17T10:00:41-05:00" level=error msg="Access Request failed with error: Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The request was determined to be using 'token_endpoint_auth_method' method 'client_secret_post', however the OAuth 2.0 client registration does not allow this method. The registered client with id 'portainer' is configured to only support 'token_endpoint_auth_method' method 'client_secret_basic'. Either the Authorization Server client registration will need to have the 'token_endpoint_auth_method' updated to 'client_secret_post' or the Relying Party will need to be configured to use 'client_secret_basic'." method=POST path=/api/oidc/token remote_ip=172.18.0.1 stack="github.com/authelia/authelia/v4/internal/handlers/handler_oidc_token.go:25

@authelia
Copy link

authelia bot commented Dec 17, 2024

Thanks for choosing to contribute @leedotpang. We lint all PR's with golangci-lint and eslint, I may add a review to your PR with some suggestions.

You are free to apply the changes if you're comfortable, alternatively you are welcome to ask a team member for advice.

Artifacts

These changes once approved by a team member will be published for testing on Buildkite, DockerHub and GitHub Container Registry.

Docker Container

  • docker pull authelia/authelia:PR8470
  • docker pull ghcr.io/authelia/authelia:PR8470

Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Walkthrough

I pity the fool who doesn't understand OpenID Connect configuration! This documentation update modifies the integration guide for Portainer with Authelia's OpenID Connect 1.0 Provider. It updates the tested version of Portainer from 2.12.2 to 2.12.4, adds token_endpoint_auth_method: client_secret_post to the Authelia client configuration, and introduces a new authentication style step: "Auth Style: In Params." These changes enhance the clarity and completeness of the integration documentation.

Changes

File Change Summary
docs/content/integration/openid-connect/portainer/index.md Updated Portainer version to 2.12.4, added token_endpoint_auth_method: client_secret_post, and introduced "Auth Style: In Params" in application configuration

Sequence Diagram

sequenceDiagram
    participant User
    participant Portainer
    participant Authelia
    participant Token Endpoint

    User->>Portainer: Attempt to authenticate
    Portainer->>Authelia: Request authentication
    Authelia->>Token Endpoint: Authenticate using client_secret_post
    Token Endpoint-->>Authelia: Validate credentials
    Authelia-->>Portainer: Provide authentication token
    Portainer-->>User: Grant access
Loading

I PITY THE FOOL who doesn't understand this authentication flow! BOOM! 💥

Possibly related PRs

  • docs(oidc): update integration documentation for Paperless #7756: The changes in this PR also involve updates to the integration documentation for Authelia, specifically regarding the OpenID Connect implementation, which aligns with the focus of the main PR on enhancing the documentation for Portainer's integration with Authelia.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed86dc2 and 40c1bb7.

⛔ Files ignored due to path filters (1)
  • docs/content/integration/openid-connect/portainer/portainer.png is excluded by !**/*.png, !**/*.png
📒 Files selected for processing (1)
  • docs/content/integration/openid-connect/portainer/index.md (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/content/integration/openid-connect/portainer/index.md

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@leedotpang leedotpang changed the title time="2024-12-17T10:00:41-05:00" level=error msg="Access Request failed with error: Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The request was determined to be using 'token_endpoint_auth_method' method 'client_secret_post', however the OAuth 2.0 client registration does not allow this method. The registered client with id 'portainer' is configured to only support 'token_endpoint_auth_method' method 'client_secret_basic'. Either the Authorization Server client registration will need to have the 'token_endpoint_auth_method' updated to 'client_secret_post' or the Relying Party will need to be configured to use 'client_secret_basic'." method=POST path=/api/oidc/token remote_ip=172.18.0.1 stack="github.com/authelia/authelia/v4/internal/handlers/handler_oidc_token.go:25 While implementing the docs: update portainer oidc config Dec 17, 2024
Copy link

netlify bot commented Dec 17, 2024

Deploy Preview for authelia-staging ready!

Name Link
🔨 Latest commit 40c1bb7
🔍 Latest deploy log https://app.netlify.com/sites/authelia-staging/deploys/6761eea8c83af500084caddc
😎 Deploy Preview https://deploy-preview-8470--authelia-staging.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 site configuration.

Copy link
Member

@james-d-elliott james-d-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Also please update the version, looks like a breaking change from portainer's end.

docs/content/integration/openid-connect/portainer/index.md Outdated Show resolved Hide resolved
Copy link
Member

@james-d-elliott james-d-elliott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@james-d-elliott james-d-elliott enabled auto-merge (squash) December 18, 2024 01:02
@james-d-elliott james-d-elliott merged commit e497146 into authelia:master Dec 18, 2024
10 checks passed
@hendrik1120
Copy link
Contributor

hendrik1120 commented Dec 18, 2024

Funny, I am on the way newer 2.21.4 BE (current LTS) and this has never been an issue as the Auth Style defaults to Auto Detect.
@leedotpang Did you change the default by any chance?
2.12 is so old I can't even find it in the release notes anymore

Edit: Just did a fresh installation of Portainer 2.25.0 CE (STS) and I am unable to replicate this issue with the default settings

@leedotpang
Copy link
Contributor Author

leedotpang commented Dec 18, 2024

@hendrik1120 hmm that's strange-- maybe it's because I'm on community edition? (just noticed you said you installed ce to test) Otherwise, I didn't modify anything, I was just trying to follow the docs from authelia and ran into this issue. It's possible this is an inconsistency with the auto-detect functionality

@hendrik1120
Copy link
Contributor

hendrik1120 commented Dec 18, 2024

Ok, that could be the case. I am unable to even find a docker image of 2.12.4, which is why I tested the latest STS version instead. Can you maybe share link where I can find an image of that version?

Your change is not wrong by any means, but 2.12.4 is at least 2 years old and without any support. We could also set Auth Style to In header because client_secret_basic is the default and more commonly used if Auto Detect has issues.

@leedotpang
Copy link
Contributor Author

@hendrik1120 You're right! I must have had a dyslexic moment because I updated that version to 2.12.4 instead of 2.21.4. Also, great callout with the last point -- especially if client_secret_basic is the most common setting, maybe that was the right decision.

@leedotpang leedotpang deleted the docs/update-portainer-oidc-config branch December 18, 2024 15:59
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.

3 participants