Skip to content

Commit 6db21aa

Browse files
authored
Merge pull request ActiveState#3320 from ActiveState/version/0-44-1-RC1
Version 0.44.1-RC1
2 parents bbb3104 + d61f609 commit 6db21aa

File tree

24 files changed

+1081
-219
lines changed

24 files changed

+1081
-219
lines changed

activestate.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,4 @@ events:
467467
- name: file-changed
468468
scope: ["internal/locale/locales"]
469469
value: build
470+
config_version: 1

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## 0.44.1
10+
11+
### Changed
12+
13+
* Authentication information is now cached between commands, increasing performance of State Tool commands.
14+
915
## 0.44.0
1016

1117
### Added

cmd/state-svc/internal/resolver/resolver.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,40 @@ func (r *Resolver) GetProcessesInUse(ctx context.Context, execDir string) ([]*gr
262262
return processes, nil
263263
}
264264

265+
func (r *Resolver) GetJwt(ctx context.Context) (*graph.Jwt, error) {
266+
if err := r.auth.MaybeRenew(); err != nil {
267+
return nil, errs.Wrap(err, "Could not renew auth token")
268+
}
269+
270+
if !r.auth.Authenticated() {
271+
return nil, nil
272+
}
273+
274+
user := r.auth.User()
275+
if user == nil {
276+
return nil, errs.New("user is nil")
277+
}
278+
279+
jwt := &graph.Jwt{
280+
Token: r.auth.BearerToken(),
281+
User: &graph.User{
282+
UserID: user.UserID.String(),
283+
Username: user.Username,
284+
Email: user.Email,
285+
Organizations: []*graph.Organization{},
286+
},
287+
}
288+
289+
for _, org := range user.Organizations {
290+
jwt.User.Organizations = append(jwt.User.Organizations, &graph.Organization{
291+
URLname: org.URLname,
292+
Role: org.Role,
293+
})
294+
}
295+
296+
return jwt, nil
297+
}
298+
265299
func handlePanics(recovered interface{}, stack []byte) {
266300
if recovered != nil {
267301
multilog.Error("Panic: %v", recovered)

0 commit comments

Comments
 (0)