feat: support EndSession with RelyingPart client

This commit is contained in:
David Sharnoff 2022-10-12 18:06:48 -07:00
parent c4b7ef9160
commit 2350b8a942
2 changed files with 38 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import (
"encoding/base64"
"errors"
"net/http"
"net/url"
"strings"
"time"
@ -577,3 +578,13 @@ func RefreshAccessToken(rp RelyingParty, refreshToken, clientAssertion, clientAs
}
return client.CallTokenEndpoint(request, tokenEndpointCaller{RelyingParty: rp})
}
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)
}