Updates.
This commit is contained in:
parent
eeed38d588
commit
6ee9223253
6 changed files with 41 additions and 10 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -35,7 +35,7 @@
|
||||||
"@vue/vue3-jest": "^27.0.0-alpha.1",
|
"@vue/vue3-jest": "^27.0.0-alpha.1",
|
||||||
"axios-mock-adapter": "^1.21.5",
|
"axios-mock-adapter": "^1.21.5",
|
||||||
"babel-jest": "^27.0.6",
|
"babel-jest": "^27.0.6",
|
||||||
"eslint": "8.45.0",
|
"eslint": "^8.45.0",
|
||||||
"eslint-config-airbnb-base": "15.0.0",
|
"eslint-config-airbnb-base": "15.0.0",
|
||||||
"eslint-import-resolver-alias": "1.1.2",
|
"eslint-import-resolver-alias": "1.1.2",
|
||||||
"eslint-plugin-import": "2.26.0",
|
"eslint-plugin-import": "2.26.0",
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
"@vue/vue3-jest": "^27.0.0-alpha.1",
|
"@vue/vue3-jest": "^27.0.0-alpha.1",
|
||||||
"axios-mock-adapter": "^1.21.5",
|
"axios-mock-adapter": "^1.21.5",
|
||||||
"babel-jest": "^27.0.6",
|
"babel-jest": "^27.0.6",
|
||||||
"eslint": "8.45.0",
|
"eslint": "^8.45.0",
|
||||||
"eslint-config-airbnb-base": "15.0.0",
|
"eslint-config-airbnb-base": "15.0.0",
|
||||||
"eslint-import-resolver-alias": "1.1.2",
|
"eslint-import-resolver-alias": "1.1.2",
|
||||||
"eslint-plugin-import": "2.26.0",
|
"eslint-plugin-import": "2.26.0",
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,10 @@ const endpoints = Object.freeze({
|
||||||
url: '/clientauth/api/v1/clientauth/validate-client-tag',
|
url: '/clientauth/api/v1/clientauth/validate-client-tag',
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
},
|
},
|
||||||
|
ValidateClientSignature: {
|
||||||
|
url: '/clientauth/api/v1/clientauth/validate-client-signature',
|
||||||
|
method: 'POST'
|
||||||
|
},
|
||||||
IsVinbyAddressPermissible: {
|
IsVinbyAddressPermissible: {
|
||||||
url: '/vehicle/api/v1/vehicle/is-vin-by-address-permissible',
|
url: '/vehicle/api/v1/vehicle/is-vin-by-address-permissible',
|
||||||
method: 'Get'
|
method: 'Get'
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
const validateISSClientTag = (clientTag) => {
|
export function validateISSClientTag(clientTag) {
|
||||||
const store = useMainStore();
|
const store = useMainStore();
|
||||||
|
|
||||||
return store.validateClientTag(clientTag)
|
return store.validateClientTag(clientTag)
|
||||||
|
|
@ -8,6 +8,14 @@ const validateISSClientTag = (clientTag) => {
|
||||||
(response) => response,
|
(response) => response,
|
||||||
() => null
|
() => null
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
export default validateISSClientTag;
|
export function validateISSClientSignature(clientTag, token, signature) {
|
||||||
|
const store = useMainStore();
|
||||||
|
|
||||||
|
return store.validateClientSignature(clientTag, token, signature)
|
||||||
|
.then(
|
||||||
|
(response) => response,
|
||||||
|
() => null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
<script>
|
<script>
|
||||||
// Supporting files
|
// Supporting files
|
||||||
import issPageValues from '@/router/router-constants/issPage-values';
|
import issPageValues from '@/router/router-constants/issPage-values';
|
||||||
import validateISSClientTag from '@/helpers/clientauth-helper';
|
import { validateISSClientTag, validateISSClientSignature } from '@/helpers/clientauth-helper';
|
||||||
import { useMainStore } from '@/store';
|
import { useMainStore } from '@/store';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -60,7 +60,7 @@ export default {
|
||||||
const resp = await validateISSClientTag(clientTag);
|
const resp = await validateISSClientTag(clientTag);
|
||||||
|
|
||||||
if (resp?.data.active && resp?.data.accountName.length > 0) {
|
if (resp?.data.active && resp?.data.accountName.length > 0) {
|
||||||
this.populateISSConfigValues(resp.data);
|
await this.populateISSConfigValues(resp.data, clientTag, queryStringParams.token, queryStringParams.signature);
|
||||||
|
|
||||||
authorized = true;
|
authorized = true;
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ export default {
|
||||||
window.location = `/?issPage=${issPageValues.WELCOME_PAGE}`;
|
window.location = `/?issPage=${issPageValues.WELCOME_PAGE}`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
populateISSConfigValues(data) {
|
async populateISSConfigValues(data, clientTag, token, signature) {
|
||||||
this.mainStore.issConfig.clientName = data.accountName;
|
this.mainStore.issConfig.clientName = data.accountName;
|
||||||
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
this.mainStore.issConfig.clientDisplayName = data.accountName; // Defaults to use the client name.
|
||||||
this.mainStore.issConfig.accountNumber = data.accountNumber;
|
this.mainStore.issConfig.accountNumber = data.accountNumber;
|
||||||
|
|
@ -87,7 +87,11 @@ export default {
|
||||||
|
|
||||||
// NOTE: This is only here for testing purposes.
|
// NOTE: This is only here for testing purposes.
|
||||||
// Will be removed and replaced by actual token / signature validation when work is completed.
|
// Will be removed and replaced by actual token / signature validation when work is completed.
|
||||||
if (data.authentication === 'RSAToken') this.mainStore.issConfig.isAuthenticated = true;
|
if (data.authentication === 'RSAToken') {
|
||||||
|
const resp = await validateISSClientSignature(clientTag, token, signature);
|
||||||
|
console.log(resp.data);
|
||||||
|
this.mainStore.issConfig.isAuthenticated = resp?.valid ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (data.clientFlags) {
|
if (data.clientFlags) {
|
||||||
|
|
|
||||||
|
|
@ -1518,11 +1518,26 @@ export const useMainStore = defineStore({
|
||||||
|
|
||||||
async validateClientTag(clientTag) {
|
async validateClientTag(clientTag) {
|
||||||
return await globalMethods.callHttpClient({
|
return await globalMethods.callHttpClient({
|
||||||
methods: endpoints.ValidateClientTag.method,
|
method: endpoints.ValidateClientTag.method,
|
||||||
endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}`
|
endpoint: `${endpoints.ValidateClientTag.url}/${clientTag}`
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async validateClientSignature(clientTag, token, signature) {
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
clientTag,
|
||||||
|
token,
|
||||||
|
signature
|
||||||
|
};
|
||||||
|
|
||||||
|
return await globalMethods.callHttpClient({
|
||||||
|
method: endpoints.ValidateClientSignature.method,
|
||||||
|
endpoint: endpoints.ValidateClientSignature.url,
|
||||||
|
payload
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
saveServiceLocation(serviceLocationInfo) {
|
saveServiceLocation(serviceLocationInfo) {
|
||||||
if (this.order.serviceLocation) {
|
if (this.order.serviceLocation) {
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue