Merge pull request #3172 from filecoin-project/feat/lotus-shed-jwt

lotus-shed: add simple jwt creation support
This commit is contained in:
Łukasz Magiera
2020-08-19 23:32:01 +02:00
committed by GitHub
4 changed files with 95 additions and 4 deletions
+4 -3
View File
@@ -37,8 +37,9 @@ func RecordValidator(ps peerstore.Peerstore) record.Validator {
}
const JWTSecretName = "auth-jwt-private" //nolint:gosec
const KTJwtHmacSecret = "jwt-hmac-secret"
type jwtPayload struct {
type JwtPayload struct {
Allow []auth.Permission
}
@@ -54,7 +55,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
}
key = types.KeyInfo{
Type: "jwt-hmac-secret",
Type: KTJwtHmacSecret,
PrivateKey: sk,
}
@@ -63,7 +64,7 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
}
// TODO: make this configurable
p := jwtPayload{
p := JwtPayload{
Allow: apistruct.AllPermissions,
}