@asgardeo/vue 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,159 @@
1
+ import { Plugin } from 'vue';
2
+ import { AsgardeoAuthException, BasicUserInfo, IdToken, HttpClientInstance, OIDCEndpoints, HttpRequestConfig, HttpResponse, Hooks, TokenExchangeRequestConfig, SignInConfig, AuthClientConfig, Config, AuthSPAClientConfig } from '@asgardeo/auth-spa';
3
+ export * from '@asgardeo/auth-spa';
4
+
5
+ /**
6
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
7
+ *
8
+ * WSO2 LLC. licenses this file to you under the Apache License,
9
+ * Version 2.0 (the "License"); you may not use this file except
10
+ * in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing,
16
+ * software distributed under the License is distributed on an
17
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
+ * KIND, either express or implied. See the License for the
19
+ * specific language governing permissions and limitations
20
+ * under the License.
21
+ */
22
+
23
+ interface VueConfig {
24
+ /**
25
+ * Prevents the SDK from automatically signing in the user if an active session exists.
26
+ */
27
+ disableAutoSignIn?: boolean;
28
+ /**
29
+ * The SDK attempts to check for an active session on the server and update
30
+ * session state automatically. This option allows disabling that behavior.
31
+ */
32
+ disableTrySignInSilently?: boolean;
33
+ /**
34
+ * The SDK's `AuthProvider` by default listens to route changes
35
+ * to detect `code` & `session_state` parameters and perform a token exchange.
36
+ * This option allows disabling that behavior.
37
+ */
38
+ skipRedirectCallback?: boolean;
39
+ }
40
+ type AuthVueConfig = AuthSPAClientConfig & VueConfig;
41
+ /**
42
+ * Interface for the Authenticated state of the user which is exposed
43
+ * via `state` object from `useAuthContext` hook.
44
+ */
45
+ interface AuthStateInterface {
46
+ /**
47
+ * The scopes that are allowed for the user.
48
+ */
49
+ allowedScopes: string;
50
+ /**
51
+ * The display name of the user.
52
+ */
53
+ displayName?: string;
54
+ /**
55
+ * The email address of the user.
56
+ */
57
+ email?: string;
58
+ /**
59
+ * Specifies if the user is authenticated or not.
60
+ */
61
+ isSignedIn: boolean;
62
+ /**
63
+ * Are the Auth requests loading.
64
+ */
65
+ isLoading: boolean;
66
+ /**
67
+ * The uid corresponding to the user who the ID token belonged to.
68
+ */
69
+ sub?: string;
70
+ /**
71
+ * The username of the user.
72
+ */
73
+ username?: string;
74
+ }
75
+ interface AuthContextInterface {
76
+ disableHttpHandler(): Promise<boolean>;
77
+ enableHttpHandler(): Promise<boolean>;
78
+ error: AsgardeoAuthException;
79
+ getAccessToken(): Promise<string>;
80
+ getUser(): Promise<BasicUserInfo>;
81
+ getDecodedIdToken(): Promise<IdToken>;
82
+ getHttpClient(): Promise<HttpClientInstance>;
83
+ getIdToken(): Promise<string>;
84
+ getOpenIDProviderEndpoints(): Promise<OIDCEndpoints>;
85
+ httpRequest(config: HttpRequestConfig): Promise<HttpResponse<any>>;
86
+ httpRequestAll(configs: HttpRequestConfig[]): Promise<HttpResponse<any>[]>;
87
+ isSignedIn(): Promise<boolean>;
88
+ on(hook: Hooks.CustomGrant, callback: (response?: any) => void, id: string): void;
89
+ on(hook: Exclude<Hooks, Hooks.CustomGrant>, callback: (response?: any) => void): void;
90
+ on(hook: Hooks, callback: (response?: any) => void, id?: string): void;
91
+ refreshAccessToken(): Promise<BasicUserInfo>;
92
+ exchangeToken(config: TokenExchangeRequestConfig, callback?: (response: BasicUserInfo | Response) => void): void;
93
+ revokeAccessToken(): Promise<boolean>;
94
+ signIn: (config?: SignInConfig, authorizationCode?: string, sessionState?: string, state?: string, callback?: (response: BasicUserInfo) => void, tokenRequestConfig?: {
95
+ params: Record<string, unknown>;
96
+ }) => Promise<BasicUserInfo>;
97
+ signOut: (callback?: (response: boolean) => void) => Promise<boolean>;
98
+ state: AuthStateInterface;
99
+ trySignInSilently: (additionalParams?: Record<string, string | boolean>, tokenRequestConfig?: {
100
+ params: Record<string, unknown>;
101
+ }) => Promise<boolean | BasicUserInfo>;
102
+ reInitialize(config: Partial<AuthClientConfig<Config>>): Promise<void>;
103
+ }
104
+ /**
105
+ * The model of the object returned by the `getAuthParams` prop method of the `AuthProvider`.
106
+ */
107
+ interface AuthParams {
108
+ authorizationCode?: string;
109
+ sessionState?: string;
110
+ state?: string;
111
+ }
112
+
113
+ /**
114
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
115
+ *
116
+ * WSO2 LLC. licenses this file to you under the Apache License,
117
+ * Version 2.0 (the "License"); you may not use this file except
118
+ * in compliance with the License.
119
+ * You may obtain a copy of the License at
120
+ *
121
+ * http://www.apache.org/licenses/LICENSE-2.0
122
+ *
123
+ * Unless required by applicable law or agreed to in writing,
124
+ * software distributed under the License is distributed on an
125
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
126
+ * KIND, either express or implied. See the License for the
127
+ * specific language governing permissions and limitations
128
+ * under the License.
129
+ */
130
+
131
+ declare const asgardeoPlugin: Plugin;
132
+
133
+ /**
134
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
135
+ *
136
+ * WSO2 LLC. licenses this file to you under the Apache License,
137
+ * Version 2.0 (the "License"); you may not use this file except
138
+ * in compliance with the License.
139
+ * You may obtain a copy of the License at
140
+ *
141
+ * http://www.apache.org/licenses/LICENSE-2.0
142
+ *
143
+ * Unless required by applicable law or agreed to in writing,
144
+ * software distributed under the License is distributed on an
145
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
146
+ * KIND, either express or implied. See the License for the
147
+ * specific language governing permissions and limitations
148
+ * under the License.
149
+ */
150
+
151
+ /**
152
+ * Hook to access the Asgardeo authentication context.
153
+ *
154
+ * @returns {AuthContextInterface} The authentication context containing authentication methods and state.
155
+ */
156
+ declare function useAsgardeo(): AuthContextInterface;
157
+
158
+ export { asgardeoPlugin, useAsgardeo };
159
+ export type { AuthContextInterface, AuthParams, AuthStateInterface, AuthVueConfig, VueConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/vue",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Vue SDK for Asgardeo - Authentication and Identity Management",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,9 +34,6 @@
34
34
  "sso",
35
35
  "identity-management"
36
36
  ],
37
- "publishConfig": {
38
- "access": "public"
39
- },
40
37
  "devDependencies": {
41
38
  "@rollup/plugin-commonjs": "^25.0.7",
42
39
  "@rollup/plugin-image": "^3.0.3",
@@ -48,10 +45,10 @@
48
45
  "@vue/eslint-config-prettier": "^8.0.0",
49
46
  "@vue/eslint-config-typescript": "^12.0.0",
50
47
  "@vue/test-utils": "^2.4.6",
51
- "@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?4ee6f6be232d7631999d709a86b91612f1d34ce7",
52
- "@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?4ee6f6be232d7631999d709a86b91612f1d34ce7",
53
- "@wso2/stylelint-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/stylelint-config?4ee6f6be232d7631999d709a86b91612f1d34ce7",
54
- "eslint": "~8.57.0",
48
+ "@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?a1fc6eb570653c999828aea9f5027cba06af4391",
49
+ "@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?a1fc6eb570653c999828aea9f5027cba06af4391",
50
+ "@wso2/stylelint-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/stylelint-config?a1fc6eb570653c999828aea9f5027cba06af4391",
51
+ "eslint": "8.57.0",
55
52
  "prettier": "^3.2.5",
56
53
  "rollup": "^4.17.2",
57
54
  "rollup-plugin-dts": "^6.1.0",
@@ -83,6 +80,9 @@
83
80
  "import": "./dist/esm/index.js",
84
81
  "require": "./dist/cjs/index.js"
85
82
  },
83
+ "publishConfig": {
84
+ "access": "public"
85
+ },
86
86
  "scripts": {
87
87
  "build": "rollup -c",
88
88
  "dev": "rollup -c -w",