Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration for a development environment #13

Merged
merged 4 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/auth.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { UserManager, WebStorageStateStore } from 'oidc-client-ts'
import {UserManager, WebStorageStateStore} from 'oidc-client-ts'

const dev_settings = {
userStore: new WebStorageStateStore({ store: window.localStorage }),
authority: 'http://localhost:4011/',
loadUserInfo: true,
user_info_endpoint: 'http://localhost:4011/connect/userinfo',
client_id: 'client-credentials-mock-client',
client_secret: 'authorization-code-with-pkce-client-secret',
redirect_uri: 'http://localhost:8080/login',
Expand Down Expand Up @@ -108,22 +110,13 @@ class AuthService {
return new Promise((resolve, reject) => {
userManager.getUser()
.then(user => {
console.log(user.access_token)
resolve(user.access_token)
})
.catch(error => reject(error))
})
}

async getClaims() {
const response = await fetch('http://localhost:4011/connect/userinfo', {
headers:
{
'Authorization': 'Bearer ' + await this.getAccessToken()
}
})
return response.json()
}


}

Expand Down
4 changes: 1 addition & 3 deletions src/store/actions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import axios from 'axios'

const BASE_API_PATH = '/api/v3'

let BASE_API_PATH = '/api/v3'
const ACCESS_CRITERIA_PATH = `${BASE_API_PATH}/access-criteria/`
const REQUESTS_PATH = `${BASE_API_PATH}/requests`
const NEGOTIATION_PATH = `${BASE_API_PATH}/negotiations`

function getBearerHeaders(token) {
return {
headers: {
Expand Down
5 changes: 2 additions & 3 deletions src/views/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export default {
return {
isUserLoggedIn: false,
authToken: "",
userClaims: undefined,
profile: undefined,
};
},
computed: {
...mapGetters({ notification: "getNotification" }),
user() {
return this.userClaims !== undefined ? this.userClaims.name : "";
return this.profile !== undefined ? this.profile.name : "";
},
},
methods: {
Expand All @@ -82,7 +82,6 @@ export default {
if (this.isUserLoggedIn) {
this.authToken = await this.$auth.getAccessToken();
this.profile = await this.$auth.getProfile();
this.userClaims = await this.$auth.getClaims();
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { fileURLToPath, URL } from "node:url";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

const PROXY_TARGET = 'http://localhost:8090'
const PROXY_TARGET = 'http://localhost:8081'

export default defineConfig({
plugins: [vue()],
Expand Down