Skip to content

Comments

Add GetLogoutUrl method for SSO logout#223

Open
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-sso-logout-issue
Open

Add GetLogoutUrl method for SSO logout#223
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-sso-logout-issue

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

The SDK was missing the logout URL method referenced in the Casdoor SSO documentation.

Changes

  • url.go: Added GetLogoutUrl(redirectUri string) client method
  • url_global.go: Added global wrapper function
  • url_test.go: Added test coverage for both variants

API

// Client method
client := casdoorsdk.NewClient(endpoint, clientId, clientSecret, cert, org, app)
logoutUrl := client.GetLogoutUrl("http://example.com/home")
// Returns: http://localhost:8000/api/logout?redirect_uri=http%3A%2F%2Fexample.com%2Fhome

// Global function
casdoorsdk.InitConfig(endpoint, clientId, clientSecret, cert, org, app)
logoutUrl := casdoorsdk.GetLogoutUrl("http://example.com/home")

// Without redirect
logoutUrl := casdoorsdk.GetLogoutUrl("")
// Returns: http://localhost:8000/api/logout

Follows existing URL method patterns (GetSigninUrl, GetSignupUrl). Redirect URI is URL-encoded when provided.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • demo.casdoor.com
    • Triggering command: /tmp/go-build3080996299/b001/casdoorsdk.test /tmp/go-build3080996299/b001/casdoorsdk.test -test.testlogfile=/tmp/go-build3080996299/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s (dns block)
  • www.casdoor.org
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>SSO Logout Using Casdoor SDK</issue_title>
<issue_description>I found the following description in the documentation:
https://www.casdoor.org/docs/session/single-sign-out#using-casdoor-sdks

It states that I can use the Go SDK to perform logout, but in practice I couldn’t find such a method in the SDK.

Did I miss something, or is there an error in the documentation?</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@hsluoyz hsluoyz marked this pull request as ready for review January 22, 2026 17:07
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SSO logout using Casdoor SDK Add GetLogoutUrl method for SSO logout Jan 22, 2026
Copilot AI requested a review from hsluoyz January 22, 2026 17:14
@hsluoyz
Copy link
Member

hsluoyz commented Jan 22, 2026

@lzgzhyf is this what you want?

@lzgzhyf
Copy link

lzgzhyf commented Jan 23, 2026

I am currently manually calling the /sso-logout endpoint in the code to log out, and it works fine. What is the difference compared to /logout?

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.

SSO Logout Using Casdoor SDK

4 participants