-
-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
XWIKI-22430: Logging out does not unlock pages that were being edited
* Provide an abstract event for authentication
- Loading branch information
Showing
3 changed files
with
74 additions
and
34 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...-api/src/main/java/org/xwiki/security/authentication/AbstractUserAuthenticationEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
|
||
package org.xwiki.security.authentication; | ||
|
||
import java.util.Objects; | ||
|
||
import org.xwiki.observation.event.Event; | ||
import org.xwiki.stability.Unstable; | ||
import org.xwiki.user.UserReference; | ||
|
||
/** | ||
* Abstract event related to authentication. | ||
* | ||
* @version $Id$ | ||
* @since 16.8.0RC1 | ||
*/ | ||
@Unstable | ||
public abstract class AbstractUserAuthenticationEvent implements Event | ||
{ | ||
/** | ||
* The reference related to an authenticated user for whom the event has been triggered. | ||
*/ | ||
private final UserReference userReference; | ||
|
||
/** | ||
* This event will match only events of the same type affecting the same user. | ||
* | ||
* @param userReference The reference related to an authenticated user for whom the event | ||
* has been triggered. | ||
*/ | ||
public AbstractUserAuthenticationEvent(UserReference userReference) | ||
{ | ||
this.userReference = userReference; | ||
} | ||
|
||
/** | ||
* @return the {@link UserReference} of the user for whom the event is triggered. | ||
*/ | ||
public UserReference getUserReference() | ||
{ | ||
return this.userReference; | ||
} | ||
|
||
@Override | ||
public boolean matches(Object other) | ||
{ | ||
return other instanceof AbstractUserAuthenticationEvent | ||
&& Objects.equals(((AbstractUserAuthenticationEvent) other).getUserReference(), this.userReference); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters