File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 33
44use Authwave \ProviderUri \AdminUri ;
55use Authwave \ProviderUri \AuthUri ;
6+ use Authwave \ProviderUri \LogoutUri ;
67use Gt \Http \Uri ;
78use Gt \Session \SessionContainer ;
89use Psr \Http \Message \UriInterface ;
@@ -79,6 +80,7 @@ public function login(Token $token = null):void {
7980 public function logout ():void {
8081// TODO: Should the logout redirect the user agent to the redirectPath?
8182 $ this ->session ->remove (self ::SESSION_KEY );
83+ $ this ->redirectHandler ->redirect ($ this ->getLogoutUri ());
8284 }
8385
8486 public function getUuid ():string {
@@ -109,6 +111,10 @@ public function getAdminUri(
109111 );
110112 }
111113
114+ public function getLogoutUri ():UriInterface {
115+ return new LogoutUri ($ this ->authwaveHost );
116+ }
117+
112118 private function completeAuth ():void {
113119 $ responseCipher = $ this ->getResponseCipher ();
114120
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Authwave \ProviderUri ;
3+
4+ class LogoutUri extends AbstractProviderUri {
5+ const PATH_LOGOUT = "/logout " ;
6+
7+ public function __construct (string $ baseRemoteUri ) {
8+ $ baseRemoteUri = $ this ->normaliseBaseUri ($ baseRemoteUri );
9+ parent ::__construct ($ baseRemoteUri );
10+ $ this ->path = self ::PATH_LOGOUT ;
11+ }
12+ }
Original file line number Diff line number Diff line change @@ -72,10 +72,15 @@ public function testLogoutClearsSession() {
7272 Authenticator::SESSION_KEY => $ sessionData
7373 ];
7474
75+ $ redirectHandler = self ::createMock (RedirectHandler::class);
76+
7577 $ sut = new Authenticator (
7678 "example-app-id " ,
7779 "test-key " ,
78- "/ "
80+ "/ " ,
81+ AuthUri::DEFAULT_BASE_REMOTE_URI ,
82+ null ,
83+ $ redirectHandler
7984 );
8085 $ sut ->logout ();
8186 self ::assertEmpty ($ _SESSION );
You can’t perform that action at this time.
0 commit comments