• Version 3.2.4
  • Published
  • 257 kB
  • 7 dependencies
  • MIT license


npm i passport-saml
yarn add passport-saml
pnpm add passport-saml


SAML 2.0 authentication strategy for Passport



class CacheProvider

class CacheProvider {}


    constructor(options: Partial<CacheProviderOptions>);

      property cacheKeys

      cacheKeys: Record<string, CacheItem>;

        property options

        options: CacheProviderOptions;

          method getAsync

          getAsync: (key: string) => Promise<string | null>;
          • Returns the value of the specified key in the cache

            Parameter id



          method removeAsync

          removeAsync: (key: string) => Promise<string | null>;
          • Removes an item from the cache if it exists

            Parameter key

          method saveAsync

          saveAsync: (key: string, value: string) => Promise<CacheItem | null>;
          • Store an item in the cache, using the specified key and value. Internally will keep track of the time the item was added to the cache

            Parameter id

            Parameter value

          class SAML

          class SAML {}


            constructor(ctorOptions: SamlConfig);

              property cacheProvider

              cacheProvider: InMemoryCacheProvider;

                property options

                options: SamlOptions;

                  method generateServiceProviderMetadata

                  generateServiceProviderMetadata: (
                  decryptionCert: string | null,
                  signingCert?: string | null
                  ) => string;

                    method getAuthorizeFormAsync

                    getAuthorizeFormAsync: (RelayState: string, host?: string) => Promise<string>;

                      method getAuthorizeUrlAsync

                      getAuthorizeUrlAsync: (
                      RelayState: string,
                      host: string | undefined,
                      options: AuthorizeOptions
                      ) => Promise<string>;

                        method getLogoutResponseUrl

                        getLogoutResponseUrl: (
                        samlLogoutRequest: Profile,
                        RelayState: string,
                        options: AuthenticateOptions & AuthorizeOptions,
                        callback: (err: Error | null, url?: string | null) => void
                        ) => void;

                          method getLogoutUrlAsync

                          getLogoutUrlAsync: (
                          user: Profile,
                          RelayState: string,
                          options: AuthenticateOptions & AuthorizeOptions
                          ) => Promise<string>;

                            method initialize

                            initialize: (ctorOptions: SamlConfig) => SamlOptions;

                              method validatePostRequestAsync

                              validatePostRequestAsync: (
                              container: Record<string, string>
                              ) => Promise<{ profile?: Profile; loggedOut?: boolean }>;

                                method validatePostResponseAsync

                                validatePostResponseAsync: (
                                container: Record<string, string>
                                ) => Promise<{ profile?: Profile | null; loggedOut?: boolean }>;

                                  method validateRedirectAsync

                                  validateRedirectAsync: (
                                  container: ParsedQs,
                                  originalQuery: string | null
                                  ) => Promise<{ profile?: Profile | null; loggedOut?: boolean }>;

                                    method validateSignature

                                    validateSignature: (
                                    fullXml: string,
                                    currentNode: Element,
                                    certs: string[]
                                    ) => boolean;


                                      interface CacheItem

                                      interface CacheItem {}
                                      • Simple in memory cache provider. To be used to store state of requests that needs to be validated/checked when a response is received.

                                        This is the default implementation of a cache provider used by Passport-SAML. For multiple server instances/load balanced scenarios (I.e. the SAML request could have been generated from a different server/process handling the SAML response) this implementation will NOT be sufficient.

                                        The caller should provide their own implementation for a cache provider as defined in the config options for Passport-SAML.

                                        Parameter options

                                      property createdAt

                                      createdAt: number;

                                        property value

                                        value: string;

                                          Package Files (3)

                                          Dependencies (7)

                                          Dev Dependencies (31)

                                          Peer Dependencies (0)

                                          No peer dependencies.


                                          To add a badge like this badgeto your package's README, use the codes available below.

                                          You may also use to create a custom badge linking to

                                          • Markdown
                                          • HTML
                                            <a href=""><img src="" alt=""></a>