-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support personal access token mechanism
- Loading branch information
Showing
27 changed files
with
1,277 additions
and
226 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
53 changes: 53 additions & 0 deletions
53
api/src/main/java/run/halo/app/security/PersonalAccessToken.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,53 @@ | ||
package run.halo.app.security; | ||
|
||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.Instant; | ||
import java.util.List; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
import run.halo.app.extension.AbstractExtension; | ||
import run.halo.app.extension.GVK; | ||
|
||
@Data | ||
@ToString(callSuper = true) | ||
@EqualsAndHashCode(callSuper = true) | ||
@GVK(group = "security.halo.run", version = "v1alpha1", kind = PersonalAccessToken.KIND, | ||
plural = "personalaccesstokens", singular = "personalaccesstoken") | ||
public class PersonalAccessToken extends AbstractExtension { | ||
|
||
public static final String KIND = "PersonalAccessToken"; | ||
|
||
private Spec spec = new Spec(); | ||
|
||
@Data | ||
@Schema(name = "PatSpec") | ||
public static class Spec { | ||
|
||
@Schema(requiredMode = REQUIRED) | ||
private String name; | ||
|
||
private String description; | ||
|
||
private Instant expiresAt; | ||
|
||
private List<String> roles; | ||
|
||
private List<String> scopes; | ||
|
||
@Schema(requiredMode = REQUIRED) | ||
private String username; | ||
|
||
private boolean revoked; | ||
|
||
private Instant revokesAt; | ||
|
||
private Instant lastUsed; | ||
|
||
@Schema(requiredMode = REQUIRED) | ||
private String tokenId; | ||
|
||
} | ||
} |
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.