-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Motivation: The anonymous role poses a security risk, as described in [issue #1048](#1048). Modifications: - Removed the anonymous role, effectively reversing changes introduced in [PR #917](#917). - Added `CentralDogmaExtension.accessToken()` for adding the access token to the testing Dogma client. - There was a bug after we introduced the anonymous role, which is an anonymous can create a project. - Becuase the anonymous role is now removed, the testing dogma client without an access token can't create a project if the auth provider is set to dogma extension. Result: - The anonymous role has been removed.
- Loading branch information
Showing
18 changed files
with
74 additions
and
153 deletions.
There are no files selected for viewing
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
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
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
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
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 |
---|---|---|
|
@@ -41,16 +41,13 @@ public class User implements Identifiable, Serializable { | |
|
||
private static final long serialVersionUID = -5429782019985526549L; | ||
|
||
private static final String LEVEL_ANONYMOUS_STR = "LEVEL_ANONYMOUS"; | ||
private static final String LEVEL_USER_STR = "LEVEL_USER"; | ||
private static final String LEVEL_ADMIN_STR = "LEVEL_ADMIN"; | ||
|
||
// System-wide roles for a user. It is different from the role in a project. | ||
public static final List<String> LEVEL_ANONYMOUS = ImmutableList.of(LEVEL_ANONYMOUS_STR); | ||
public static final List<String> LEVEL_USER = ImmutableList.of(LEVEL_USER_STR); | ||
public static final List<String> LEVEL_ADMIN = ImmutableList.of(LEVEL_ADMIN_STR, LEVEL_USER_STR); | ||
|
||
public static final User ANONYMOUS = new User("[email protected]", LEVEL_ANONYMOUS); | ||
public static final User DEFAULT = new User("[email protected]", LEVEL_USER); | ||
public static final User ADMIN = new User("[email protected]", LEVEL_ADMIN); | ||
|
||
|
@@ -61,8 +58,6 @@ public class User implements Identifiable, Serializable { | |
|
||
private final boolean isAdmin; | ||
|
||
private final boolean isAnonymous; | ||
|
||
/** | ||
* Creates a new instance. | ||
*/ | ||
|
@@ -76,7 +71,6 @@ public User(@JsonProperty("login") String login, | |
this.email = requireNonNull(email, "email"); | ||
this.roles = ImmutableList.copyOf(requireNonNull(roles, "roles")); | ||
isAdmin = roles.stream().anyMatch(LEVEL_ADMIN_STR::equals); | ||
isAnonymous = roles.stream().anyMatch(LEVEL_ANONYMOUS_STR::equals); | ||
} | ||
|
||
/** | ||
|
@@ -101,7 +95,6 @@ public User(String login, List<String> roles) { | |
|
||
this.roles = ImmutableList.copyOf(roles); | ||
isAdmin = roles.stream().anyMatch(LEVEL_ADMIN_STR::equals); | ||
isAnonymous = roles.stream().anyMatch(LEVEL_ANONYMOUS_STR::equals); | ||
} | ||
|
||
/** | ||
|
@@ -148,13 +141,6 @@ public boolean isAdmin() { | |
return isAdmin; | ||
} | ||
|
||
/** | ||
* Returns {@code true} if this user is anonymous. | ||
*/ | ||
public boolean isAnonymous() { | ||
return isAnonymous; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
|
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
Oops, something went wrong.