Next Auth Saml

screenshot of Next Auth Saml
nextjs
react

NextJS SAML authentication with Next-Auth.js.

Overview

Next-Auth.js SAML Example is a comprehensive solution for integrating SAML authentication into Next.js applications. Built with a sample application that leverages the capabilities of Next-Auth.js and saml2-js, this setup demonstrates how to authenticate users with SAML Identity Providers (IdPs). With the convenience of Docker Compose, developers can quickly spin up a development environment, allowing for seamless testing and implementation of SAML authentication flows.

This setup not only simplifies the process of SAML configuration but also provides a clear framework for customizing and extending functionality. By using a mock IdP, developers can experiment without the complexities of setting up a real IdP, making it an ideal starting point for anyone looking to implement SAML authentication in their Next.js applications.

Features

  • Docker-Compose Integration: The repository includes a Docker-Compose file that allows easy setup of the Next.js app and a mock IdP, streamlining the development process.

  • Mock Identity Provider: Simplifies testing by exposing a mock IdP, making it easy to simulate SAML authentication scenarios on localhost.

  • User Credentials: Out-of-the-box login credentials (user1 and user1pass) enable quick access to the application for testing purposes.

  • CSRF Token Management: Features a unique solution to handle CSRF tokens needed for authentication callbacks, ensuring secure SAML assertion processing.

  • Customizable Integration: Developers can customize the authentication flow by modifying the necessary API route and Credential provider configurations to suit specific application requirements.

  • Promise-Based Redirects: Utilizes Promise-based responses for SAML sign-in flows, enabling efficient handling of authentication states and error management.

  • Open Source Contribution: The repository welcomes contributions, providing an opportunity for developers to enhance the functionality, such as extending support for multiple IdPs or improving SAML POST request management.

  • Clear Documentation: Well-structured guidance on prerequisites, setup, and basic usage, ensuring an accessible entry point for developers new to SAML and Next-Auth.js.

nextjs
Next.js

Next.js is a React-based web framework that enables server-side rendering, static site generation, and other powerful features for building modern web applications.

react
React

React is a widely used JavaScript library for building user interfaces and single-page applications. It follows a component-based architecture and uses a virtual DOM to efficiently update and render UI components