Skip to content

SP Integration Guide - OnPrem

Setting Up a SharePoint On-Prem for InspectRAG’s Keycloak Integration and Event Receivers


Table of Contents

  1. Introduction
  2. Prerequisites
  3. Setting Up a SharePoint On-Premises Site
  4. Configuring Keycloak for Authentication with LDAP and Active Directory
  5. Deploying Event Receivers to SharePoint On-Premises
  6. Setting Up Webhooks using Event Receivers
  7. Conclusion
  8. References

1. Introduction

This integration guide provides a step-by-step approach to setting up a SharePoint On-Prem site integrated with Keycloak LDAP for user authentication (for InspectRAG environment) and event receivers to handle file uploads, updates, and notifications. It ensures secure access by linking Active Directory roles with SharePoint and automates event handling through event receivers.

The integration is four-step workflow, as explained below:

image.png


2. Prerequisites

  • SharePoint On-Premises installed and configured.
  • Administrative access to the SharePoint server.
  • Active Directory set up with appropriate users and groups.
  • Keycloak server configured with LDAP integration.
  • Visual Studio for building event receivers (if creating custom logic).
  • SharePoint Management Shell installed for deploying solutions.
  • Public URL (if using webhooks) accessible from the SharePoint server.

3. Step-1: Setting Up a SharePoint On-Prem Site

  1. Access SharePoint Central Administration:
    • Log in to the SharePoint server and open Central Administration.
    • Navigate to Application Management.
  2. Create a New Site Collection:
    • Select Create Site Collections under Manage Web Applications.
    • Choose the appropriate Web Application.
  3. Provide Site Details:
    • Title: Enter a unique name for the site collection.
    • Template: Choose a template (e.g., Team Site).
    • Primary Administrator: Assign a site owner.
    • Time Zone: Select the appropriate time zone.
  4. Finalize the Setup:
    • Click OK to create the site collection.
    • Wait for the site collection to be provisioned.

4. Step-2: Configuring Keycloak for Authentication with LDAP and Active Directory

  1. Connect Keycloak to Active Directory via LDAP:
    • Access the Keycloak Admin Console and go to User Federation.
    • Add a new LDAP provider and enter the following:
      • LDAP URL: Your Active Directory server URL.
      • Bind DN: The user with access to LDAP queries.
      • User DN: The base path in Active Directory (e.g., OU=Users,DC=example,DC=com).
  2. Sync Users and Groups:
    • Enable synchronization to import users and groups from Active Directory.
    • Set the sync to periodic if you want it to run automatically.
  3. Map Active Directory Roles to Keycloak Groups:
    • Configure Group-to-Role Mapping under the LDAP settings.
    • Ensure roles and permissions from Active Directory are synchronized to Keycloak.
  4. Configure SharePoint to Use Keycloak for Authentication:
    • Set up Keycloak as a trusted identity provider in SharePoint using SAML or OAuth.
    • Ensure users logging in via Keycloak have roles mapped to SharePoint permissions.

5. Step-3: Deploying Event Receivers to SharePoint On-Prem

  1. What Are Event Receivers?
    • Event receivers in SharePoint allow automated handling of events like file uploads, updates, or deletions.
  2. Deploying an Event Receiver:
    • Create your event receiver in Visual Studio or use an existing one.
    • Package the event receiver into a WSP (Windows SharePoint Solution) file.
  3. Upload and Deploy the WSP to SharePoint:
    • Use SharePoint Central Administration or SharePoint Management Shell to upload and deploy the solution.
    • Ensure the event receiver is deployed at the site collection level or list level based on your requirement.
  4. Activate the Event Receiver:
    • Navigate to the Site Settings of your site collection.
    • Activate the feature linked to the event receiver.

6. Step-4: Setting Up Webhooks using Event Receivers

  1. How Webhooks Work with Event Receivers:
    • When a file is added or updated in SharePoint, the event receiver triggers an action.
    • Use the event receiver to send notifications to external systems or process files further.
  2. Configuring the Event Receiver for File Uploads:
    • Ensure the event receiver is attached to the Document Library where files are uploaded.
    • The event receiver can log details or trigger further workflows (like sending notifications).
  3. Handling Change Notifications:
    • Use event receivers to monitor changes in files.
    • The event receiver can send alerts or trigger API calls to update external systems (e.g., Keycloak).
  4. Integrate with Keycloak Using Webhooks:
    • If a user uploads a restricted file, the event receiver can validate if the user’s roles from Keycloak allow the action.
    • If not, the event receiver can block the action and log an error message.

7. Conclusion

This guide covered the setup of a SharePoint On-Prem site with InspectRAG’s Keycloak LDAP integration and event receivers for handling automated file uploads and notifications. With Active Directory roles mapped through Keycloak, users can securely access SharePoint based on their permissions. Event receivers provide the ability to handle file events seamlessly, ensuring real-time processing and secure collaboration.


8. References