Skip to content

mwohlf/charon

Repository files navigation

Charon

https://github.com/mwohlf/charon/actions/workflows/gradle-build.yml

intro

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

oauth module

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.

Some OAuth Endpoints provided by the Server

URL service

http://localhost:9000/.well-known/openid-configuration

issuer config endpoint

http://localhost:9000/.well-known/oauth-authorization-server

server config endpoint

frontend module

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

simple ngrx concepts

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.

backend module

SpringBoot endpoints in Kotlin and hosting the webjar at

buildSrc module

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 \

.github

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

etc

contains API definition, scripts, deployment descriptions, helm charts


update UI components:

cd frontend
ncu -u
npm install --legacy-peer-deps

if UI build fail on GitHub, try deleting the caches and trigger another build

build

npm install --legacy-peer-deps

running docker without docker desktop

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors