Skip to content

Instantly share code, notes, and snippets.

View maitrungduc1410's full-sized avatar
💪
Keep chasing your dreams!

Duc Trung Mai maitrungduc1410

💪
Keep chasing your dreams!
View GitHub Profile
@maitrungduc1410
maitrungduc1410 / angular.json
Last active September 25, 2022 03:15
Angular (NGX) Intro.js
{
"projects": {
"ngx-introjs": {
"architect": {
"build": {
"options": {
"styles": [
"node_modules/intro.js/introjs.css"
],
"scripts": [
@maitrungduc1410
maitrungduc1410 / index.js
Last active December 27, 2022 03:25
Import users from OpenEdx to Keycloak with NodeJS
import KcAdminClient from "@keycloak/keycloak-admin-client";
const kcAdminClient = new KcAdminClient({
baseUrl: "http://localhost:8080",
realmName: "myrealm",
});
const credentials = {
grantType: "password",
username: "superuser",
@maitrungduc1410
maitrungduc1410 / _silent-check-sso.html
Last active January 4, 2023 04:18
Openedx Keycloak Federated Logout (Single sign out)
<html>
<body>
<script>
parent.postMessage(location.href, location.origin)
</script>
</body>
</html>
@maitrungduc1410
maitrungduc1410 / _silent-check-sso.html
Created January 4, 2023 04:13
Openedx Keycloak federated login (SSO)
<html>
<body>
<script>
parent.postMessage(location.href, location.origin)
</script>
</body>
</html>
@maitrungduc1410
maitrungduc1410 / middleware.ts
Created July 8, 2023 03:40
Sync session between Next Auth and Keycloak
import { withAuth } from "next-auth/middleware";
export default withAuth(
{
pages: {
signIn: "/auth/signin",
},
callbacks: {
authorized: async ({ token }) => {
if (!(token as any)?.id_token) return false;
@maitrungduc1410
maitrungduc1410 / Dockerfile
Created October 22, 2023 03:38
Docker Centos Nginx JWT
FROM quay.io/sclorg/nginx-120-c8s as base
FROM base as builder
USER root
ARG JWT_MODULE_PATH=/usr/local/lib/ngx-http-auth-jwt-module
ARG LIBJWT_VERSION=1.13.1
ARG NGINX_VERSION=1.20.0