1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-21 07:29:37 +01:00

Merge branch 'master' into fix-1267

This commit is contained in:
VerdaccioBot 2019-03-30 09:49:29 +01:00 committed by GitHub
commit f7dc60f946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -411,10 +411,13 @@ class Auth implements IAuth {
}
async jwtEncrypt(user: RemoteUser, signOptions: JWTSignOptions): string {
const { real_groups } = user;
const { real_groups, name, groups } = user;
const realGroupsValidated = _.isNil(real_groups) ? [] : real_groups;
const groupedGroups = _.isNil(groups) ? real_groups : groups.concat(realGroupsValidated);
const payload: RemoteUser = {
...user,
group: real_groups && real_groups.length ? real_groups : undefined,
real_groups: realGroupsValidated,
name,
groups: groupedGroups,
};
const token: string = await signPayload(payload, this.secret, signOptions);