feat: support EndSession with RelyingPart client

This commit is contained in:
David Sharnoff 2022-10-12 18:06:48 -07:00
parent 763d69b4ca
commit 045d612e93
2 changed files with 39 additions and 1 deletions

View file

@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"net/http"
"net/url"
"strings"
"time"
@ -601,3 +602,13 @@ func RevokeToken(rp RelyingParty, token string, tokenTypeHint string) error {
}
return fmt.Errorf("RelyingParty does not support RevokeCaller")
}
func EndSession(rp RelyingParty, idToken, optionalRedirectURI, optionalState string) (*url.URL, error) {
request := oidc.EndSessionRequest{
IdTokenHint: idToken,
ClientID: rp.OAuthConfig().ClientID,
PostLogoutRedirectURI: optionalRedirectURI,
State: optionalState,
}
return client.CallEndSessionEndpoint(request, nil, rp)
}