Comments (6)
That would be very useful. Would you accept PR or should I create definition in separate repository?
import { PluginObject, PluginFunction } from 'vue'
export class VueKeyCloakInstance {
ready: boolean; // Flag indicating whether Keycloak has initialised and is ready
authenticated: boolean;
userName: string; // Username from Keycloak. Collected from tokenParsed['preferred_username']
fullName: string; // Full name from Keycloak. Collected from tokenParsed['name']
login: Function; // [Keycloak] login function
loginFn: Function; // Alias for login
logoutFn: Function; // Keycloak logout function
createLoginUrl: Function; // Keycloak createLoginUrl function
createLogoutUrl: Function; // Keycloak createLogoutUrl function
createRegisterUrl: Function; // Keycloak createRegisterUrl function
register: Function; // Keycloak register function
accountManagement: Function; // Keycloak accountManagement function
createAccountUrl: Function; // Keycloak createAccountUrl function
loadUserProfile: Function; // Keycloak loadUserProfile function
loadUserInfo: Function; // Keycloak loadUserInfo function
subject: string; // The user id
idToken: string; // The base64 encoded ID token.
idTokenParsed: object; // The parsed id token as a JavaScript object.
realmAccess: object; // The realm roles associated with the token.
resourceAccess: object; // The resource roles associated with the token.
refreshToken: string; // The base64 encoded refresh token that can be used to retrieve a new token.
refreshTokenParsed: object; // The parsed refresh token as a JavaScript object.
timeSkew: number; // The estimated time difference between the browser time and the Keycloak server in seconds. This value is just an estimation, but is accurate enough when determining if a token is expired or not.
responseMode: string; // Response mode passed in init (default value is fragment).
responseType: string; // Response type sent to Keycloak with login requests. This is determined based on the flow value used during initialization, but can be overridden by setting this value.
hasRealmRole: Function; // Keycloak hasRealmRole function
hasResourceRole: Function; // Keycloak hasResourceRole function
token: string; // The base64 encoded token that can be sent in the Authorization header in requests to services
tokenParsed: string; // The parsed token as a JavaScript object
}
export type VueKeyCloakOptions = {
config?: {
authUrl?: string;
authRealm?: string;
authClientId?: string;
logoutRedirectUri?: string;
};
init?: {
onLoad: string;
};
onReady(keycloak: VueKeyCloakInstance): void;
}
export class VueKeyCloak implements PluginObject<VueKeyCloakOptions> {
install: PluginFunction<VueKeyCloakOptions>;
static install(pVue: typeof Vue, options?:VueKeyCloakOptions | undefined): void;
constructor(options: VueKeyCloakOptions);
}
from vue-keycloak-js.
It's not something we currently have considered, so the short answer is 'no'.
But we're happy to receive PR's 😉
from vue-keycloak-js.
Please feel free to submit a PR
from vue-keycloak-js.
That would be very useful. Would you accept PR or should I create definition in separate repository?
import { PluginObject, PluginFunction } from 'vue' export class VueKeyCloakInstance { ready: boolean; // Flag indicating whether Keycloak has initialised and is ready authenticated: boolean; userName: string; // Username from Keycloak. Collected from tokenParsed['preferred_username'] fullName: string; // Full name from Keycloak. Collected from tokenParsed['name'] login: Function; // [Keycloak] login function loginFn: Function; // Alias for login logoutFn: Function; // Keycloak logout function createLoginUrl: Function; // Keycloak createLoginUrl function createLogoutUrl: Function; // Keycloak createLogoutUrl function createRegisterUrl: Function; // Keycloak createRegisterUrl function register: Function; // Keycloak register function accountManagement: Function; // Keycloak accountManagement function createAccountUrl: Function; // Keycloak createAccountUrl function loadUserProfile: Function; // Keycloak loadUserProfile function loadUserInfo: Function; // Keycloak loadUserInfo function subject: string; // The user id idToken: string; // The base64 encoded ID token. idTokenParsed: object; // The parsed id token as a JavaScript object. realmAccess: object; // The realm roles associated with the token. resourceAccess: object; // The resource roles associated with the token. refreshToken: string; // The base64 encoded refresh token that can be used to retrieve a new token. refreshTokenParsed: object; // The parsed refresh token as a JavaScript object. timeSkew: number; // The estimated time difference between the browser time and the Keycloak server in seconds. This value is just an estimation, but is accurate enough when determining if a token is expired or not. responseMode: string; // Response mode passed in init (default value is fragment). responseType: string; // Response type sent to Keycloak with login requests. This is determined based on the flow value used during initialization, but can be overridden by setting this value. hasRealmRole: Function; // Keycloak hasRealmRole function hasResourceRole: Function; // Keycloak hasResourceRole function token: string; // The base64 encoded token that can be sent in the Authorization header in requests to services tokenParsed: string; // The parsed token as a JavaScript object } export type VueKeyCloakOptions = { config?: { authUrl?: string; authRealm?: string; authClientId?: string; logoutRedirectUri?: string; }; init?: { onLoad: string; }; onReady(keycloak: VueKeyCloakInstance): void; } export class VueKeyCloak implements PluginObject<VueKeyCloakOptions> { install: PluginFunction<VueKeyCloakOptions>; static install(pVue: typeof Vue, options?:VueKeyCloakOptions | undefined): void; constructor(options: VueKeyCloakOptions); }
Did you make PR anywhere ? I need TS support too :)
from vue-keycloak-js.
@lukaslaskovski here is PR, but I haven't work with TypeScript for multiple months already, so I am not quite sure if it will work out of the box. Please check if it works.
from vue-keycloak-js.
@nlien @anderius Can this PR (#64 ) be merged ?
from vue-keycloak-js.
Related Issues (20)
- how to define $keycloak on vue 3 using JavaScript HOT 11
- Constant refreshing when logged in and using offline_access token HOT 5
- Keycloak instance not available in vue3 HOT 2
- Keycloak - Ionic/Capacitor HOT 2
- URL fragments are not being removed upon successful login HOT 2
- For my keycloak version (18), the url configuration should not have "/auth" in the vite_vue3 example HOT 1
- $keycloak with vue 3 and vue-router 4 HOT 5
- Vue3 HOT 1
- Configurable token update interval
- The Vue 3 injection Symbol should be in a separate file and exported HOT 7
- Implementing PKCE with vue-keycloak-js HOT 2
- Always Redirect with URL #error=login_required HOT 3
- [vite] Internal server error: Failed to resolve import "@dsb-norge/vue-keycloak-js/dist/types" from "src/main.ts". Does the file exist? HOT 2
- [question] Where can I get an indication that the token has expired as a basis for jumping to the login
- Vue3 Support
- Support for Keycloak v21 HOT 1
- Cannot use namespace 'Keycloak' as a type HOT 2
- [question] Why and how do I prevent a blank page when the Keycloak server is not available? Vue, Keycloak, Quasar
- Refresh the system page and automatically add a hash parameter after the URL. How to remove the following parameters
- js-sha256 warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-keycloak-js.