mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 12:59:06 +01:00
Fix missing metaData in archive; Add iat to JWTs
This commit is contained in:
parent
a9f6da7595
commit
a448868f9c
@ -386,6 +386,12 @@ func (api *RestApi) stopJob(rw http.ResponseWriter, r *http.Request) {
|
||||
go func() {
|
||||
defer api.OngoingArchivings.Done()
|
||||
|
||||
if _, err := api.JobRepository.FetchMetadata(job); err != nil {
|
||||
log.Errorf("archiving job (dbid: %d) failed: %s", job.ID, err.Error())
|
||||
api.JobRepository.UpdateMonitoringStatus(job.ID, schema.MonitoringStatusArchivingFailed)
|
||||
return
|
||||
}
|
||||
|
||||
// metricdata.ArchiveJob will fetch all the data from a MetricDataRepository and create meta.json/data.json files
|
||||
jobMeta, err := metricdata.ArchiveJob(job, context.Background())
|
||||
if err != nil {
|
||||
|
@ -375,17 +375,17 @@ func (auth *Authentication) ProvideJWT(user *User) (string, error) {
|
||||
return "", errors.New("environment variable 'JWT_PRIVATE_KEY' not set")
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
claims := jwt.MapClaims{
|
||||
"sub": user.Username,
|
||||
"roles": user.Roles,
|
||||
"iat": now.Unix(),
|
||||
}
|
||||
if auth.JwtMaxAge != 0 {
|
||||
claims["exp"] = time.Now().Add(auth.JwtMaxAge).Unix()
|
||||
claims["exp"] = now.Add(auth.JwtMaxAge).Unix()
|
||||
}
|
||||
|
||||
tok := jwt.NewWithClaims(jwt.SigningMethodEdDSA, claims)
|
||||
|
||||
return tok.SignedString(auth.jwtPrivateKey)
|
||||
return jwt.NewWithClaims(jwt.SigningMethodEdDSA, claims).SignedString(auth.jwtPrivateKey)
|
||||
}
|
||||
|
||||
func GetUser(ctx context.Context) *User {
|
||||
|
Loading…
Reference in New Issue
Block a user