Facade

In addition to the methods already mentioned, the SAML facade provides access to the following helper methods:

  • SAML::attributes() - get all SAML attributes for the currently logged in user
  • SAML::attribute($key) - get the specified SAML attribute for the currently logged in user (use data_get() dotted notation, e.g. email.0)
  • SAML::string loginUrl(string $redirectTo, array $params = []) - returns a URL for the SAML server login page
    • SAML::string reauthUrl(string $redirectTo, array $params = []) - forces re-authentication even if the user is already logged in
    • SAML::string passiveLoginUrl(string $redirectTo, array $params = []) - checks if the user is already logged in but may redirect back without them authenticating (TODO: Untested)
  • SAML::string logoutUrl(string $redirectTo, array $params = []) - returns a URL for the SAML server logout page
  • SAML::attributesToUser(array $attributes) - converts the attributes array from SAML to a User object (or null), using the following helpers:
    • SAML::findOrCreateUserUsingConfig(array $attributes) - the default implementation (can be called directly from the attributesToUserCallback() callback)
    • SAML::findUser(array $attributes, array $matchFields = [], array $setFields = []) - finds a user but doesn't create one
    • SAML::findOrCreateUser(array $attributes, array $matchFields = [], array $setFields = []) - finds or creates a user
  • SAML::auth() - get the underlying OneLogin\Saml2\Auth instance

Note: There are a couple more that are for internal use only and should not be called directly:

  • SAML::redirect(string $url)
  • SAML::accessDenied(array $attributes)