This is a POC for implementing an OAuth Server and an Angular UI using it, in mostly Kotlin/Typescript, basically showing off:
-
a fancy buildSrc with re-usable custom plugins
-
using webjars to integrate the UI with the Spring boot service
-
using Kotlin for implementing spring-boot backends
-
material Angular with theme switching and OAuth for authentication
-
using OpenAPI for "API-first" code generation for
-
the backend (controllers)
-
the frontend (services)
-
-
using GitHub’s actions and build pipeline
-
a fancy deployment in azure
I think this is today’s state-of-the-art web application development
This module implements an OAuth Service and is based on the spring-security-oauth2-authorization-server SpringBoot module.
We want to use the OAuth Code Flow for authentication.
Documentation can be found here:
Okta Code GRant Docu
Spring OAuth Server Howto
GitHub Spring AOuth Server
Federated OAuth Server Config
Stackoverflow Spring OAuth Server
GitHub OAuth Server POC
Some OAuth Endpoints provided by the Server
| URL | service |
|---|---|
issuer config endpoint |
|
http://localhost:9000/.well-known/oauth-authorization-server |
server config endpoint |
This module implements a simple UI using the OAuth backend for authentication.
Setup steps:
npm i ng update @angular/core ng update @angular/cli ng generate component components/home ng generate component components/main ng generate component components/error ng generate component components/protected ng add @angular/material ng add @angular/cdk ng generate @angular/material:navigation navigation npm install angular-auth-oidc-client --registry https://registry.npmjs.org --legacy-peer-deps
oauth module from here:
https://github.com/damienbod/angular-auth-oidc-client
https://angular-auth-oidc-client.com/docs/documentation/public-api
proxy service config:
https://angular.io/guide/build#proxying-to-a-backend-server
- Actions
-
Describe unique events, dispatched from Components (Users), Services (Backends) and might contain data.
- Reducer
-
Convert action types, the data from actions and the current state into a new State.
- Effects
-
Listen to an observable of every action dispatched from the store, interact with Services, Isolate side effects, return new actions. Also include state (e.g. with withLatestFrom(this.store.select(selectOAuthFeature)) ) to create a new action.
- Components
-
Select and render state, dispatch actions.
SpringBoot endpoints in Kotlin and hosting the webjar at
This contains the custom, re-usable build scripts for kotlin & spring-boot, angular, docker etc.
The only requirement is having git, java and docker in the build environment, for ubuntu this means:
sudo apt-get install \ git \ openjdk-21-jdk \ docker \
the GitHub pipelines or workflows
-
aks-deploy.yml
trigger a helm chart deploy from the etc/helm directory -
gradle-build.yml
trigger the gradle jib build for creating the images configured by the buildSrc
contains API definition, scripts, deployment descriptions, helm charts
cd frontend
ncu -u
npm install --legacy-peer-depsif UI build fail on GitHub, try deleting the caches and trigger another build
- build
-
npm install --legacy-peer-deps
https://github.com/spring-projects/spring-authorization-server
https://www.appsdeveloperblog.com/spring-authorization-server-tutorial/
spring-projects/spring-authorization-server#796
spring-projects/spring-authorization-server#297
https://docs.spring.io/spring-authorization-server/docs/current/reference/html/guides/how-to-userinfo.html
install with choco:
-
docker-cli
-
docker-compose
-
use the WSL context in idea to connect to a docker deamon
-
set the path do docker.exe/docker-compose.exe in idea
see: https://linuxhandbook.com/nginx-reverse-proxy-docker/ https://hub.docker.com/r/nginxproxy/acme-companion https://linuxhandbook.com/nginx-reverse-proxy-docker/ https://github.com/nginx-proxy/nginx-proxy https://stackoverflow.com/questions/66102225/jrcs-letsencrypt-nginx-proxy-companion-docker-image-too-many-certificates-alr