Compare commits

..

No commits in common. "7a0edc13766a347187eb9177dfbccd3b8210ff50" and "8848f4af9c58572b51a398dfce88b56a1f7a7257" have entirely different histories.

8 changed files with 4 additions and 98 deletions

View file

@ -1,14 +1,13 @@
# A modern Keycloak login theme # A modern Keycloak login theme
keycloak-modern-login is a Keycloak login theme that's build using Tailwind CSS, Vue.js 3 and Typescript. It is easily extensible and bypasses the complexity of FreeMarker templates. keycloak-modern-login is a Keycloak login theme that's build using Vue.js 3 and Typescript. It is easily extensible and bypasses the complexity of FreeMarker templates.
<details> <details>
<summary>Screenshots</summary> <summary>Screenshots</summary>
![](docs/login-form.jpg) ![](docs/login-form.jpg)
![](docs/login-webauthn.jpg) ![](docs/login-webauthn.jpg)
</details> </details>
## State of this project ## State of this project

View file

@ -325,16 +325,6 @@ export declare namespace KcContextBase {
attributesByName: Record<string, Attribute>; attributesByName: Record<string, Attribute>;
}; };
}; };
export type SAMLPostForm = Common & {
pageId: "saml-post-form.ftl"
samlPost: {
url: string;
SAMLRequest?: string;
SAMLResponse?: string;
relayState?: string;
}
};
} }
export type Attribute = { export type Attribute = {

View file

@ -1,5 +0,0 @@
export type SAMLPostData = {
SAMLRequest?: string,
SAMLResponse?: string,
relayState?: string,
}

View file

@ -1,6 +0,0 @@
<#import "baselayout.ftl" as layout>
<@layout.baseLayout pageId="saml-post-form.ftl" ; section>
<#if section = "scripts">
<script typo="module" src="${url.resourcesPath}/js/saml-post-form.js"></script>
</#if>
</@layout.baseLayout>

View file

@ -1,7 +0,0 @@
import { createApp } from "vue";
import index from "./index.vue";
if ((window as any).kcContext) {
const app = createApp(index);
app.mount("#app");
}

View file

@ -1,65 +0,0 @@
<template>
<layout>
<div class="flex justify-center justify-items-center">
<svg class="h-15 w-15 animate-spin" preserveAspectRatio="xMidYMid">
<circle cx="50%" cy="50%" r="35" fill="none" stroke="#374151" stroke-width="10" stroke-dasharray="164 56"/>
</svg>
</div>
<h1 class="mt-4 text-xl text-center text-gray-700">Redirecting...</h1>
</layout>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import Layout from "~/components/Layout.vue";
import type { KcContextBase } from "~/types/context";
import type { SAMLPostData } from "~/types/samlPostData"
export default defineComponent({
name: "SamlPostForm",
components: {
Layout,
},
data() {
return {
context: (window as any).kcContext as KcContextBase.SAMLPostForm,
};
},
mounted: function () {
const postData: SAMLPostData = {
SAMLRequest: this.context.samlPost.SAMLRequest,
SAMLResponse: this.context.samlPost.SAMLResponse,
relayState: this.context.samlPost.relayState,
};
this.formPost(this.context.samlPost.url, postData);
},
methods: {
formPost(url: string, data: object) {
const form = document.createElement("form");
form.method = "post";
form.action = url;
for (const key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
if (data[key] === undefined) {
continue;
}
const hiddenField = document.createElement("input");
hiddenField.type = "hidden";
hiddenField.name = key;
hiddenField.value = data[key];
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
},
},
});
</script>
<style>
@tailwind base;
@tailwind components;
@tailwind utilities;
</style>

View file

@ -86,7 +86,7 @@ import type { KcContextBase } from "~/types/context";
import { base64url } from "rfc4648"; import { base64url } from "rfc4648";
export default defineComponent({ export default defineComponent({
name: "WebAuthnAuthenticate", name: "Login",
components: { components: {
Layout, Layout,
ErrorBox, ErrorBox,

View file

@ -5,7 +5,7 @@ const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin");
const THEME_NAME = "modern-login"; const THEME_NAME = "modern-login";
const customPages = ["login", "webauthn-authenticate", "saml-post-form"]; const customPages = ["login", "webauthn-authenticate"];
module.exports = function (env, argv) { module.exports = function (env, argv) {
const isDevelopment = argv.mode !== "production"; const isDevelopment = argv.mode !== "production";