Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 960 Bytes

README.md

File metadata and controls

39 lines (31 loc) · 960 Bytes

@/saml-alterior

Adds support for SAML 2.0 to Alterior applications.

Installation

npm install @astronautlabs/saml-alterior

Usage

Add the SamlController to your application:

import { WebService, Response } from '@alterior/web-server';
import { SamlModule, SamlController } from '@astronautlabs/saml-alterior';
@WebService({
    imports: [
        SamlModule.configure({
            identityProvider: '...',
            serviceProvider: '...'
        })
    ]
})
class MyService {
    @Mount('/saml') saml: SamlController;

    altAfterInit() {
        this.saml.handleSignInResponse = (response, returnURL) => {
            // Validate the SAML response and set up a security context in some way.
            // Afterwards, redirect the user back to their destination.
            Response.temporaryRedirect(returnURL).throw();
        };
    }
}

Now you can send your user to, eg. example.com/saml?return=RETURNURL.