import { default as AuthProvider, AuthProviderProps } from '../AuthProvider'; import { AuthResult, MfaChallenge } from '@plitzi/sdk-shared'; export type ServerAuthProviderProps = AuthProviderProps & { /** Where the page server starts a sign-in by redirect. Default `/auth/sign-in` (`createServer({ signIn })`). */ loginUrl?: string; /** Where the page server ends the session on its host. Default `/auth/logout`. */ logoutUrl?: string; }; /** * A space whose people sign in THROUGH the server that renders it: signing in is a redirect out and back * (`createServer({ signIn })` — "Sign in with Plitzi" on the platform), and the session is a cookie on the space's * own host that the page never holds. * * So there is nothing here to store, renew or ask about. Who is signed in is what the server rendered the page for — * it resolves the visitor on every request and hands the answer over with the page — and it is the server that ends a * session. What this provider does is the two things only a browser can: go and sign in, and ask to sign out. */ declare class ServerAuthProvider> extends AuthProvider { readonly name = "server"; private readonly loginUrl; private readonly logoutUrl; constructor({ loginUrl, logoutUrl, ...providerProps }?: ServerAuthProviderProps); protected get capabilities(): { renew: boolean; identity: boolean; }; /** * Off to sign in, and back to this very page. The promise never settles: the page is being left, and whatever it * said next would be said to nobody. */ protected requestLogin(): Promise | MfaChallenge>; protected requestRenewal(): Promise>; protected requestIdentity(): Promise>; protected requestLogout(): Promise; /** * Nothing to confirm from here: the page cannot see its own session, and the server answers who is signed in on * every page it serves. The session stands as the server rendered it until the server says otherwise. */ revalidate(): Promise; } export default ServerAuthProvider;