@drax/identity-front 0.0.8 → 0.0.10
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.
- package/package.json +6 -18
- package/src/errors/BadCredentialsError.ts +8 -0
- package/src/factories/providers/AuthProviderFactory.ts +29 -0
- package/src/{core/factories → factories}/system/AuthSystemFactory.ts +2 -2
- package/src/helpers/AuthHelper.ts +32 -0
- package/src/helpers/JwtDecodeHelper.ts +79 -0
- package/src/i18n/identity-permissions-i18n.ts +43 -0
- package/src/i18n/identity-role-i18n.ts +27 -0
- package/src/i18n/identity-user-i18n.ts +59 -0
- package/src/i18n/identity-validation-i18n.ts +29 -0
- package/src/i18n/index.ts +10 -0
- package/src/index.ts +52 -10
- package/src/interfaces/IAuthProvider.ts +12 -0
- package/src/interfaces/IAuthUser.ts +15 -0
- package/src/interfaces/ILoginResponse.ts +5 -0
- package/src/interfaces/IRole.ts +10 -0
- package/src/interfaces/IRoleProvider.ts +13 -0
- package/src/interfaces/IUser.ts +39 -0
- package/src/interfaces/IUserProvider.ts +14 -0
- package/src/providers/gql/AuthGqlProvider.ts +59 -0
- package/src/providers/gql/RoleGqlProvider.ts +74 -0
- package/src/providers/gql/UserGqlProvider.ts +63 -0
- package/src/providers/rest/AuthRestProvider.ts +51 -0
- package/src/providers/rest/RoleRestProvider.ts +61 -0
- package/src/providers/rest/UserRestProvider.ts +55 -0
- package/src/system/AuthSystem.ts +35 -0
- package/src/system/RoleSystem.ts +43 -0
- package/src/system/UserSystem.ts +41 -0
- package/src/assets/base.css +0 -86
- package/src/assets/logo.svg +0 -1
- package/src/assets/main.css +0 -35
- package/src/components/HelloWorld.vue +0 -41
- package/src/components/IdentityLogin/IdentityLogin.vue +0 -82
- package/src/components/__tests__/IdentityLogin.spec.ts +0 -11
- package/src/components/icons/IconCommunity.vue +0 -7
- package/src/components/icons/IconDocumentation.vue +0 -0
- package/src/components/icons/IconEcosystem.vue +0 -0
- package/src/components/icons/IconSupport.vue +0 -0
- package/src/components/icons/IconTooling.vue +0 -0
- package/src/core/factories/providers/AuthProviderFactory.ts +0 -28
- package/src/core/interfaces/IAuthProviderInterface.ts +0 -5
- package/src/core/providers/gql/AuthGqlProvider.ts +0 -19
- package/src/core/providers/rest/AuthRestProvider.ts +0 -19
- package/src/core/system/AuthSystem.ts +0 -21
- package/src/stores/auth/AuthStore.ts +0 -19
- package/src/stores/counter.ts +0 -12
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor">
|
|
3
|
-
<path
|
|
4
|
-
d="M15 4a1 1 0 1 0 0 2V4zm0 11v-1a1 1 0 0 0-1 1h1zm0 4l-.707.707A1 1 0 0 0 16 19h-1zm-4-4l.707-.707A1 1 0 0 0 11 14v1zm-4.707-1.293a1 1 0 0 0-1.414 1.414l1.414-1.414zm-.707.707l-.707-.707.707.707zM9 11v-1a1 1 0 0 0-.707.293L9 11zm-4 0h1a1 1 0 0 0-1-1v1zm0 4H4a1 1 0 0 0 1.707.707L5 15zm10-9h2V4h-2v2zm2 0a1 1 0 0 1 1 1h2a3 3 0 0 0-3-3v2zm1 1v6h2V7h-2zm0 6a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2zm-1 1h-2v2h2v-2zm-3 1v4h2v-4h-2zm1.707 3.293l-4-4-1.414 1.414 4 4 1.414-1.414zM11 14H7v2h4v-2zm-4 0c-.276 0-.525-.111-.707-.293l-1.414 1.414C5.42 15.663 6.172 16 7 16v-2zm-.707 1.121l3.414-3.414-1.414-1.414-3.414 3.414 1.414 1.414zM9 12h4v-2H9v2zm4 0a3 3 0 0 0 3-3h-2a1 1 0 0 1-1 1v2zm3-3V3h-2v6h2zm0-6a3 3 0 0 0-3-3v2a1 1 0 0 1 1 1h2zm-3-3H3v2h10V0zM3 0a3 3 0 0 0-3 3h2a1 1 0 0 1 1-1V0zM0 3v6h2V3H0zm0 6a3 3 0 0 0 3 3v-2a1 1 0 0 1-1-1H0zm3 3h2v-2H3v2zm1-1v4h2v-4H4zm1.707 4.707l.586-.586-1.414-1.414-.586.586 1.414 1.414z"
|
|
5
|
-
/>
|
|
6
|
-
</svg>
|
|
7
|
-
</template>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type {IGqlClientInterface, IHttpClientInterface} from '@drax/common-front'
|
|
2
|
-
import {GqlApolloClientFactory, HttpFetchClientFactory} from '@drax/common-front';
|
|
3
|
-
import type {IAuthProviderInterface} from "@/core/interfaces/IAuthProviderInterface";
|
|
4
|
-
import AuthRestProvider from "@/core/providers/gql/AuthGqlProvider";
|
|
5
|
-
import AuthGqlProvider from "@/core/providers/gql/AuthGqlProvider";
|
|
6
|
-
class AuthProviderFactory{
|
|
7
|
-
static create(type: string = 'rest'): IAuthProviderInterface {
|
|
8
|
-
if (type === 'gql') {
|
|
9
|
-
return AuthProviderFactory.createGql()
|
|
10
|
-
}
|
|
11
|
-
return AuthProviderFactory.createRest()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
static createGql(): IAuthProviderInterface {
|
|
15
|
-
const gqlClient: IGqlClientInterface = GqlApolloClientFactory.create()
|
|
16
|
-
return new AuthGqlProvider(gqlClient)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static createRest(): IAuthProviderInterface {
|
|
20
|
-
const baseUrl = process.env.VUE_APP_BACKEND_URL ? process.env.VUE_APP_BACKEND_URL : ''
|
|
21
|
-
const baseHeaders = new Headers()
|
|
22
|
-
const httpClient: IHttpClientInterface = HttpFetchClientFactory.create(baseUrl,baseHeaders)
|
|
23
|
-
return new AuthRestProvider(httpClient)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default AuthProviderFactory
|
|
28
|
-
export {AuthProviderFactory}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type {IGqlClientInterface} from '@drax/common-front'
|
|
2
|
-
import type {IAuthProviderInterface} from "../../interfaces/IAuthProviderInterface.ts";
|
|
3
|
-
class AuthGqlProvider implements IAuthProviderInterface{
|
|
4
|
-
|
|
5
|
-
gqlClient : IGqlClientInterface
|
|
6
|
-
constructor(gqlClient: IGqlClientInterface) {
|
|
7
|
-
this.gqlClient = gqlClient
|
|
8
|
-
}
|
|
9
|
-
async login(username: string, password: string): Promise<object> {
|
|
10
|
-
|
|
11
|
-
const url : string = ''
|
|
12
|
-
const data = {username, password}
|
|
13
|
-
let r = this.gqlClient.mutation(url, data)
|
|
14
|
-
|
|
15
|
-
return r
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default AuthGqlProvider
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type {IHttpClientInterface} from '@drax/common-front'
|
|
2
|
-
import type {IAuthProviderInterface} from "../../interfaces/IAuthProviderInterface.ts";
|
|
3
|
-
class AuthRestProvider implements IAuthProviderInterface{
|
|
4
|
-
|
|
5
|
-
httpClient : IHttpClientInterface
|
|
6
|
-
constructor(httpClient: IHttpClientInterface) {
|
|
7
|
-
this.httpClient = httpClient
|
|
8
|
-
}
|
|
9
|
-
async login(username: string, password: string): Promise<object> {
|
|
10
|
-
const url = '/api/auth'
|
|
11
|
-
const data = {username,password}
|
|
12
|
-
let r = await this.httpClient.post(url,data)
|
|
13
|
-
|
|
14
|
-
return r
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default AuthRestProvider
|
|
19
|
-
export {AuthRestProvider}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type {IAuthProviderInterface} from "../interfaces/IAuthProviderInterface.ts";
|
|
2
|
-
|
|
3
|
-
class AuthSystem {
|
|
4
|
-
|
|
5
|
-
_provider : IAuthProviderInterface
|
|
6
|
-
prototype: string;
|
|
7
|
-
constructor(provider:IAuthProviderInterface) {
|
|
8
|
-
this._provider = provider;
|
|
9
|
-
this.prototype = 'AuthSystem'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async login(username:string, password:string):Promise<object> {
|
|
13
|
-
console.log("AuthSystem.login username",username)
|
|
14
|
-
const r = await this._provider.login(username, password)
|
|
15
|
-
console.log("AuthSystem.login",r)
|
|
16
|
-
return r
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default AuthSystem
|
|
21
|
-
export {AuthSystem}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Utilities
|
|
2
|
-
import { defineStore } from 'pinia'
|
|
3
|
-
import AuthSystem from "../../core/system/AuthSystem.js";
|
|
4
|
-
|
|
5
|
-
export const useAuthStore = defineStore('AuthStore', {
|
|
6
|
-
state: () => ({
|
|
7
|
-
authSystem : null as AuthSystem | null
|
|
8
|
-
}),
|
|
9
|
-
actions:{
|
|
10
|
-
setAuthSystem(authSystem:AuthSystem){
|
|
11
|
-
this.authSystem = authSystem
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
getters:{
|
|
15
|
-
getAuthSystem: (state) => {
|
|
16
|
-
return state.authSystem
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
})
|
package/src/stores/counter.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ref, computed } from 'vue'
|
|
2
|
-
import { defineStore } from 'pinia'
|
|
3
|
-
|
|
4
|
-
export const useCounterStore = defineStore('counter', () => {
|
|
5
|
-
const count = ref(0)
|
|
6
|
-
const doubleCount = computed(() => count.value * 2)
|
|
7
|
-
function increment() {
|
|
8
|
-
count.value++
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return { count, doubleCount, increment }
|
|
12
|
-
})
|