{"version":3,"sources":["../../src/session/common.ts"],"sourcesContent":["import type { SecurityContext, Session } from './types';\n\nexport const SPRING_SECURITY_CONTEXT = 'SPRING_SECURITY_CONTEXT';\nexport const PRINCIPAL_NAME_INDEX_NAME = `org.springframework.session.FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME`;\n\nexport function resolveIndexesFor(session: Session): string | null {\n  const principalName = session.getAttribute(PRINCIPAL_NAME_INDEX_NAME) as string | null;\n  if (principalName !== null) return principalName;\n\n  const jsonString = session.getAttribute(SPRING_SECURITY_CONTEXT);\n  if (typeof jsonString === 'string') {\n    const context = JSON.parse(jsonString) as SecurityContext;\n    return context?.authentication?.name ?? context.authentication?.principal?.name ?? null;\n  }\n  return null;\n}\n"],"mappings":";AAEO,IAAM,0BAA0B;AAChC,IAAM,4BAA4B;AAElC,SAAS,kBAAkB,SAAiC;AACjE,QAAM,gBAAgB,QAAQ,aAAa,yBAAyB;AACpE,MAAI,kBAAkB,KAAM,QAAO;AAEnC,QAAM,aAAa,QAAQ,aAAa,uBAAuB;AAC/D,MAAI,OAAO,eAAe,UAAU;AAClC,UAAM,UAAU,KAAK,MAAM,UAAU;AACrC,WAAO,SAAS,gBAAgB,QAAQ,QAAQ,gBAAgB,WAAW,QAAQ;AAAA,EACrF;AACA,SAAO;AACT;","names":[]}