MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / LogoutURL

Method LogoutURL

server-source-code/internal/auth/oidc/client.go:450–471  ·  view source on GitHub ↗

LogoutURL builds the RP-initiated logout URL if the provider supports it. Returns empty string if the provider has not yet been discovered or does not advertise an end_session_endpoint.

(postLogoutRedirectURI, idTokenHint, clientID string)

Source from the content-addressed store, hash-verified

448// Returns empty string if the provider has not yet been discovered or does not
449// advertise an end_session_endpoint.
450func (c *Client) LogoutURL(postLogoutRedirectURI, idTokenHint, clientID string) string {
451 c.mu.Lock()
452 provider := c.provider
453 c.mu.Unlock()
454 if provider == nil {
455 return ""
456 }
457 var meta struct {
458 EndSessionEndpoint string `json:"end_session_endpoint"`
459 }
460 if err := provider.Claims(&meta); err != nil || meta.EndSessionEndpoint == "" {
461 return ""
462 }
463
464 params := url.Values{}
465 params.Set("client_id", clientID)
466 params.Set("post_logout_redirect_uri", postLogoutRedirectURI)
467 if idTokenHint != "" {
468 params.Set("id_token_hint", idTokenHint)
469 }
470 return meta.EndSessionEndpoint + "?" + params.Encode()
471}

Callers 1

LogoutMethod · 0.80

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected