-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Teletraan AuthN and AuthZ implementation
commit-id:bf5d6dfa
- Loading branch information
1 parent
37a187d
commit 5b174d7
Showing
97 changed files
with
3,096 additions
and
1,763 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
74 changes: 0 additions & 74 deletions
74
deploy-service/common/src/main/java/com/pinterest/deployservice/bean/Resource.java
This file was deleted.
Oops, something went wrong.
50 changes: 0 additions & 50 deletions
50
deploy-service/common/src/main/java/com/pinterest/deployservice/bean/Role.java
This file was deleted.
Oops, something went wrong.
64 changes: 64 additions & 0 deletions
64
...service/common/src/main/java/com/pinterest/deployservice/bean/TeletraanPrincipalRole.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,64 @@ | ||
/** | ||
* Copyright (c) 2024, Pinterest Inc. All rights reserved. | ||
*/ | ||
package com.pinterest.deployservice.bean; | ||
|
||
import com.pinterest.teletraan.universal.security.bean.RoleEnum; | ||
import com.pinterest.teletraan.universal.security.bean.ValueBasedRole; | ||
|
||
|
||
/** | ||
* READER: | ||
* Default role, everyone who is able to use Teletraan has READER access. | ||
* PINGER: | ||
* Role required to ping server. | ||
* PUBLISHER: | ||
* Role required to publish artifacts. | ||
* OPERATOR: | ||
* Role where user can modify a specific environment's config and | ||
* perform deploy related actions. | ||
* ADMIN: | ||
* Role that has the same environment specific privileges as OPERATOR | ||
* plus the ability specify new OPERATORS and ADMINs for said environment. | ||
* When a new environment is created the creating user is the designated the | ||
* first ADMIN. | ||
*/ | ||
public enum TeletraanPrincipalRole implements RoleEnum<ValueBasedRole> { | ||
READ(-1), | ||
READER(0), // legacy | ||
PINGER(1), // legacy | ||
PUBLISHER(1), // legacy | ||
EXECUTE(9), | ||
WRITE(9), | ||
DELETE(9), | ||
OPERATOR(10), // legacy | ||
ADMIN(20); | ||
|
||
public class Names { | ||
private Names() {} | ||
public static final String PINGER = "PINGER"; | ||
public static final String PUBLISHER = "PUBLISHER"; | ||
public static final String READER = "READER"; | ||
public static final String OPERATOR = "OPERATOR"; | ||
public static final String ADMIN = "ADMIN"; | ||
|
||
public static final String READ = "READ"; | ||
public static final String WRITE = "WRITE"; | ||
public static final String EXECUTE = "EXECUTE"; | ||
public static final String DELETE = "DELETE"; | ||
} | ||
|
||
private final ValueBasedRole role; | ||
|
||
TeletraanPrincipalRole(int value) { | ||
this.role = new ValueBasedRole(value); | ||
} | ||
|
||
public ValueBasedRole getRole() { | ||
return role; | ||
} | ||
|
||
public boolean isEqualOrSuperior(TeletraanPrincipalRole otherRole) { | ||
return this.role.isEqualOrSuperior(otherRole.getRole()); | ||
} | ||
} |
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.