Search Results :

×

SAML Single Sign-On (SSO) For Laravel Using Keycloak As IDP

SAML Single Sign-On (SSO) For Laravel Using Keycloak As IDP


Laravel SAML Single Sign-On (SSO) plugin gives the ability to enable SAML Single Sign-On for your laravel applications. Using Single Sign-On you can use only one password to access your laravel application and services. Our plugin is compatible with all the SAML compliant Identity providers. Here we will go through a step-by-step guide to configure Single Sign-On (SSO) between Laravel and Keycloak considering Keycloak as IdP.

Pre-requisites : Download And Installation

  • Open a Command Prompt window and change the working directory to your Laravel app's main directory.
  • Enter the below command.
    composer require miniorange/saml-laravel-free
  • Laravel Single Sign On SSO enter commond
  • Note: If you are using Laravel 5.4 or below, you will need to add the following value to the 'providers' array in your app.php file which can be found in the project\config folder :provider\ssoServiceProvider::class (You can check your current Laravel version by using the command php artisan --version.)

  • Laravel Single Sign On SSO add following value
  • After successful installation of package, go to your Laravel app in the browser and enter https://<your-host>/mo_admin in the address bar.
  • The package will start setting up your database for you and then redirect you to the admin registration page.
  • Register or log in with your account by clicking the Register button to configure the plugin.
  • Laravel Single Sign On SSO plugin settings
  • After login, you will see the Service Provider Settings option, where you will get the service provider metadata. Keep the metadata handy as it will be required later to configure step 1.
  • Laravel Single Sign On SSO Service Provider Settings

Steps to configure Keycloak Single Sign-On (SSO) Login into Laravel

1. Configure Keycloak as Identity Provider

  • In your Keycloak Admin console, select the realm that you want to use.
  • Click on Clients from the left menu and then click on Create button to create a new client/application.
  • Creating an APP -  Keycloak SSO - Keycloak Login into WordPress
  • Enter SP-EntityID / Issuer as the Client ID from the "Service Provider Metadata" Tab and select SAML as the Client Protocol.
  • Add Client -  Keycloak SSO - Keycloak Login into WordPress
  • Now click on Save.
  • Configure Keycloak by providing the required details:
  • Client ID The SP-EntityID / Issuer from the plugin's Service Provider Metadata tab
    Name Provide a name for this client
    Description Provide a description
    Client Signature Required OFF
    Force POST Binding OFF
    Force Name ID Format OFF
    Name ID Format Email
    Root URL Leave empty or Provide Base URL from Service Provider Metadata tab
    Valid Redirect URIs The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Keycloak Login - Settings -  Keycloak SSO - Keycloak Login into WordPress Keycloak Login - Settings -  Keycloak SSO - Keycloak Login into WordPress
  • Under Fine Grain SAML Endpoint Configuration, Enter the following details:
  • Assertion Consumer Service POST Binding URL The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Logout Service Redirect Binding URL (Optional) The Single Logout URL from the plugin's Service Provider Metadata tab
    Login SAML Endpoint Configuration -  Keycloak SSO - Keycloak Login into WordPress
  • Click on Save.
  • In your Keycloak Admin console, select the realm that you want to use.
  • Click on Clients from the left menu and then click on Create Client button to create a new client/application.
  • Creating an APP -  Keycloak SSO - Keycloak Login into WordPress
  • Select SAML as Client type, Enter SP-EntityID / Issuer as the Client ID from the "Service Provider Metadata" Tab,Enter Name of your application and enter Description.
  • Add Client -  Keycloak SSO - Keycloak Login into WordPress
  • Now click on Save.
  • Configure Keycloak by providing the required details:
  • Client ID The SP-EntityID / Issuer from the plugin's Service Provider Metadata tab
    Name Provide a name for this client
    Description Provide a description
    Client Signature Required OFF
    Force POST Binding OFF
    Force Name ID Format OFF
    Name ID Format Email
    Root URL Leave empty or Provide Base URL from Service Provider Metadata tab
    Valid Redirect URIs The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Keycloak Login - Settings -  Keycloak SSO - Keycloak Login into WordPress Keycloak Login - Settings -  Keycloak SSO - Keycloak Login into WordPress Keycloak Login - Settings -  Keycloak SSO - Keycloak Login into WordPress
  • Now click on Save.
  • In Advanced tab,under Fine Grain SAML Endpoint Configuration, Enter the following details:
  • Assertion Consumer Service POST Binding URL The ACS (Assertion Consumer Service) URL from the plugin's Service Provider Metadata tab
    Logout Service Redirect Binding URL (Optional) The Single Logout URL from the plugin's Service Provider Metadata tab
    Login SAML Endpoint Configuration -  Keycloak SSO - Keycloak Login into WordPress
  • Click on Save.

miniorange img  Add Mappers

  • Navigate to Mappers tab and click on Add Builtin button.
  • Keycloak Login - Mappers Tab -  Keycloak SSO - Keycloak Login into WordPress
  • Select the checkboxes of X500 givenName, X500 surname and X500 email attributes.
  • Keycloak Login - Add built-in protocol mapper -  Keycloak SSO - Keycloak Login into WordPress
  • Click on Add Selected button. You will see the mappings that are added below.
  • Keycloak Login - Add Selected -  Keycloak SSO - Keycloak Login into WordPress
  • In Client scopes tab,click on your application.
  • Keycloak Login - Mappers Tab -  Keycloak SSO - Keycloak Login into WordPress
  • Click on Add predefined mapper. Keycloak Login - Mappers Tab -  Keycloak SSO - Keycloak Login into WordPress
  • Select the checkboxes of X500 givenName, X500 surname and X500 email attributes.
  • Keycloak Login - Mappers Tab -  Keycloak SSO - Keycloak Login into WordPress
  • Click on Add button.
  • You will see the mappings that are added below.
  • Keycloak Login - Mappers Tab -  Keycloak SSO - Keycloak Login into WordPress

miniorange img Download setup file

  • Navigate to Realm Settings, click on SAML 2.0 Identity Provider Metadata mentioned as Endpoints in the General Tab.
  • JBoss Keycloak SSO-7 -  Keycloak SSO - Keycloak Login into WordPress
  • Note the URL and keep it handy. That will provide you with the Endpoints required to configure the plugin.

2. Configure Laravel SAML plugin as Service Provider

  • Go to the miniOrange Laravel SAML 2.0 SSO plugin and Enter the required details which you will get from Step 1. Add the Identity Provider Issuer under IDP Entity ID and Identity Provider Single Sign-On URL under SAML Login URL.
  • Click on Test Configuration button to test whether the SAML Configuration you've done is correct. On successful test configuration, you will get the different user attributes returned by your identity Provider in a test configuration table.
  • Laravel Single Sign On SSO Test Configuration Laravel Single Sign On SSO Test Result

3. SSO Options

  • Your users can initiate the Single Sign On flow by clicking on the Single Sign On button generated on your login page. If you do not have this page yet, run php artisan make:auth & php artisan migrate to generate the authentication module.

  • Laravel Single Sign On SSO Single Sign On button

In this Guide, you have successfully configured Keycloak SAML Single Sign-On (Keycloak SSO Login) choosing Keycloak as IdP and Laravel as SP using miniOrange plugin-SAML Single Sign On – SSO Login. This solution ensures that you are ready to roll out secure access to your Laravel site using Keycloak login credentials within minutes.

Additional Resources

Hello there!

Need Help? We are right here!

support
Contact miniOrange Support
success

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to info@xecurify.com