-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2092 from HubSpot/groups_scopes_rework
Rework auth to include scopes as well as groups
- Loading branch information
Showing
51 changed files
with
1,797 additions
and
340 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
public enum SingularityAuthorizationScope { | ||
READ, | ||
WRITE, | ||
ADMIN | ||
ADMIN, | ||
DEPLOY | ||
} |
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
74 changes: 74 additions & 0 deletions
74
SingularityBase/src/main/java/com/hubspot/singularity/WebhookAuthUser.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,74 @@ | ||
package com.hubspot.singularity; | ||
|
||
import static com.google.common.collect.ImmutableSet.copyOf; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
public class WebhookAuthUser { | ||
private final String uid; | ||
private final Set<String> groups; | ||
private final Set<String> scopes; | ||
|
||
@JsonCreator | ||
public WebhookAuthUser( | ||
@JsonProperty("uid") String uid, | ||
@JsonProperty("groups") Set<String> groups, | ||
@JsonProperty("scopes") Set<String> scopes | ||
) { | ||
this.uid = uid; | ||
this.groups = groups; | ||
this.scopes = scopes; | ||
} | ||
|
||
public String getUid() { | ||
return uid; | ||
} | ||
|
||
public Set<String> getGroups() { | ||
return groups; | ||
} | ||
|
||
public Set<String> getScopes() { | ||
return scopes; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
WebhookAuthUser that = (WebhookAuthUser) o; | ||
return ( | ||
Objects.equals(uid, that.uid) && | ||
Objects.equals(groups, that.groups) && | ||
Objects.equals(scopes, that.scopes) | ||
); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(uid, groups, scopes); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return ( | ||
"WebhookAuthUser{" + | ||
"uid='" + | ||
uid + | ||
'\'' + | ||
", groups=" + | ||
groups + | ||
", scopes=" + | ||
scopes + | ||
'}' | ||
); | ||
} | ||
} |
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
Oops, something went wrong.