Refactor AuthenticatedState to store displayName and uid
The AuthenticatedState interface was updated to directly store the `displayName` and `uid` properties. Previously, it stored the entire `CasContent` object, which contained these properties along with others that were not consistently used. This change simplifies the interface and reduces redundancy.
This commit is contained in:
@@ -77,13 +77,14 @@ export const handler: MiddlewareHandler<State>[] = [
|
||||
context.state.isFromPolytech = isFromPolytech;
|
||||
|
||||
if (isFromPolytech) {
|
||||
context.state.session = session;
|
||||
context.state.displayName = session.displayName;
|
||||
context.state.uid = session.uid;
|
||||
|
||||
if (session.eduPersonPrimaryAffiliation.includes("faculty")) {
|
||||
if (session.eduPersonPrimaryAffiliation == "faculty") {
|
||||
context.state.role = "professeur"
|
||||
} else if (session.eduPersonPrimaryAffiliation.includes("employee")) {
|
||||
} else if (session.eduPersonPrimaryAffiliation == "employee") {
|
||||
context.state.role = "administration"
|
||||
} else if (session.eduPersonPrimaryAffiliation.includes("student")) {
|
||||
} else if (session.eduPersonPrimaryAffiliation == "student") {
|
||||
context.state.role = "etudiant";
|
||||
} else {
|
||||
context.state.role = "autre";
|
||||
|
||||
Reference in New Issue
Block a user