-
-
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 for personal access token mechanism (#4598)
#### What type of PR is this? /kind feature /kind api-change /area core #### What this PR does / why we need it: Support for personal access token mechanism. #### Which issue(s) this PR fixes: Fixes #1309 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note 提供个人访问令牌机制 ```
- Loading branch information
Showing
49 changed files
with
3,743 additions
and
554 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.