@kir-dev/passport-authsch
Version:
Passport.js Strategy for AuthSCH
54 lines • 2.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAuthSchProfile = void 0;
const parseAuthSchProfile = (profileData) => {
var _a, _b, _c, _d, _e, _f, _g;
return ({
authSchId: profileData.sub,
fullName: profileData.name,
lastName: profileData.family_name,
firstName: profileData.given_name,
birthdate: profileData.birthdate,
email: profileData.email,
emailVerfied: profileData.email_verified,
bme: {
eduId: profileData['bme.hu:eduPersonPrincipalName'],
neptun: profileData['bme.hu:niifPersonOrgID'],
bmeStatus: ((_b = (_a = profileData['meta.bme.hu:unitScope/v1']) === null || _a === void 0 ? void 0 : _a.split(' ')) !== null && _b !== void 0 ? _b : []),
attendedCourses: profileData['bme.hu:niifEduPersonAttendedCourse/v1'],
updatedAt: profileData['meta.bme.hu:updated_at'],
},
schAcc: {
schAccUsername: profileData['directory.sch.bme.hu:sAMAccountName'],
groups: profileData['directory.sch.bme.hu:groups/v1'],
roles: profileData.roles,
updatedAt: profileData['meta.directory.sch.bme.hu:updated_at'],
},
pek: {
pekId: profileData['pek.sch.bme.hu:uid'],
executiveAt: (_c = profileData['pek.sch.bme.hu:executiveAt/v1']) === null || _c === void 0 ? void 0 : _c.map((m) => ({ groupId: m.id, groupName: m.name })),
activeMemberAt: (_d = profileData['pek.sch.bme.hu:activeMemberships/v1']) === null || _d === void 0 ? void 0 : _d.map((m) => ({
groupId: m.id,
groupName: m.name,
titles: m.title,
})),
alumniMemberAt: (_e = profileData['pek.sch.bme.hu:alumniMemberships/v1']) === null || _e === void 0 ? void 0 : _e.map((m) => ({
groupId: m.id,
groupName: m.name,
start: m.start,
end: m.end,
})),
updatedAt: profileData['meta.pek.sch.bme.hu:updated_at'],
},
entrants: (_f = profileData['pek.sch.bme.hu:entrants/v1']) === null || _f === void 0 ? void 0 : _f.map((e) => ({
groupId: e.groupId,
groupName: e.groupName,
entrantType: e.entrantType,
})),
address: (_g = profileData.address) === null || _g === void 0 ? void 0 : _g.formatted,
phone: profileData.phone_number,
phoneVerified: profileData.phone_number_verified,
});
};
exports.parseAuthSchProfile = parseAuthSchProfile;
//# sourceMappingURL=util.js.map