Table of Contents
Authentication using Visma Federation Services (BankId, Freya).
A website that want's to autenticate an interactive user should provide
- a login page with a (web) link to /api/v1/auth/login providing
- a landing page that will collect access and refresh tokens from /api/v1/auth/token
sequenceDiagram
participant Login page
participant Landing page
participant GDI Auth Server
participant Visma Federation Services
participant User
Login page->>GDI Auth Server: GET /api/v1/login?redirect_url=<landing page>&relay_state=...
GDI Auth Server->>Visma Federation Services: Redirects to
Visma Federation Services->>User: Collects credentials and authenticates
Visma Federation Services->>Landing page: redirects to <landing page>?ts_sessionid_=...&relay_state=...
Landing page->>GDI Auth Server: GET /api/v1/auth/token?ts_session_id=...
Landing page->>Landing page: Landing page now has {accessToken, refreshToken}
In order to run, some environment variables must be defined. This is easiest to do by
- ensuring there exists a local
.env
in the project root - copy content from .env.example and change values to what gives meaning
# install dependencies
yarn
# run tests
yarn test
# run tests and report coverage
yarn coverage
# start web server
yarn start
# start server on port 400 instead of default 3000
PORT=4000 yarn start
# start with debugging output
DEBUG=* yarn start
Navigate to http://localhost:3000/api/v1/auth/login?redirect_url=http://localhost:3000/api/v1/auth/test-landing-page. It should take you through the authenticationprocess and in the end present issued access and refreh tokens.
- Authenticate against Visma (BankId, Freja)
- issue JWT access tokens and refresh tokens
- access token reneval
- handle refresh token validity
- handle refresh token revocation
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.