Skip to content

Add SPA sample using Backend For Frontend and Spring Cloud Gateway #1816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

jgrandja
Copy link
Collaborator

This SPA sample provides a reference implementation of the Backend For Frontend (BFF) application architecture pattern.

The spa-client is the frontend SPA implemented with Angular and the backend-for-spa-client is the backend application.

The backend-for-spa-client uses Spring Cloud Gateway to route /userinfo (UserInfo Endpoint) requests to demo-authorizationserver and /messages requests to messages-resource.

The backend-for-spa-client performs the authorization flows and stores the access tokens.

The spa-client is never exposed the access tokens and directly communicates with the backend-for-spa-client via an authenticated session cookie.

Related gh-297, gh-564

@jgrandja jgrandja self-assigned this Nov 14, 2024
@jgrandja jgrandja added the type: enhancement A general enhancement label Nov 14, 2024
@jgrandja jgrandja added this to the 1.4.0 milestone Nov 14, 2024
@jgrandja jgrandja merged commit a6d9c19 into spring-projects:main Nov 19, 2024
2 checks passed
@jgrandja jgrandja deleted the spa-bff-sample branch November 19, 2024 02:01
@amrnyang
Copy link

@jgrandja Hi, I read the code of spa-client and I saw that authorizeMessages() is called once for each request to /messages. Is this necessary?

@little3201
Copy link

why use spring-cloud-gateway-mvc not spring-cloud-gateway, would add samples with spring-cloud-gateway ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants