Skip to content

Commit

Permalink
Merge pull request #585 from bcgov/feature/backToApp
Browse files Browse the repository at this point in the history
"Back to" URL
  • Loading branch information
esune authored Jul 19, 2024
2 parents 16f909e + 1936971 commit a56f232
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
7 changes: 5 additions & 2 deletions demo/vue/app/frontend/src/components/base/BaseAuthButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export default {
login() {
if (this.keycloakReady) {
window.location.replace(
this.createLoginUrl() + '&pres_req_conf_id=' + this.presReqConfId
this.createLoginUrl() +
'&pres_req_conf_id=' +
this.presReqConfId +
'&back_to_url=http://localhost:8080/',
);
}
},
Expand All @@ -39,7 +42,7 @@ export default {
window.location.replace(
this.createLogoutUrl({
redirectUri: `${location.origin}/${this.$config.basePath}`,
})
}),
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion docker/keycloak/config/keycloak_import.json
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@
"config": {
"validateSignature": "true",
"clientId": "keycloak",
"forwardParameters": "pres_req_conf_id",
"forwardParameters": "pres_req_conf_id,back_to_url",
"tokenUrl": "http://controller:5000/token",
"authorizationUrl": "http://localhost:5000/authorize",
"clientAuthMethod": "client_secret_basic",
Expand Down
37 changes: 31 additions & 6 deletions oidc-controller/api/templates/verified_credentials.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@
border-color: var(--bc-primary);
color: var(--bc-primary);
}
.back-btn {
display: block;
margin-bottom: 1em;
font-weight: bold;
text-decoration: none;
}
.desktop-head .back-btn {
margin-left: -350px;
}

/* BC Gov Styles */
.btn {
--bs-btn-hover-bg: var(--bc-secondary);
Expand Down Expand Up @@ -163,17 +173,24 @@
v-on:click="bcIdClicks++"
/>
</nav>

<main class="container flex-fill mt-4 text-center">
<h1 v-if="!mobileDevice" class="mb-3">Scan with a Digital Wallet</h1>
<div v-if="!mobileDevice" class="desktop-head">
<a v-if="backToUrl" :href="backToUrl" class="back-btn"
>&#129144; Go back
</a>
<h1 class="mb-3">Scan with a Digital Wallet</h1>
</div>
<div class="row">
<div
class="col mx-auto"
:class="{'custom-column': state.current !== 'failed'}"
>
<h1 v-if="mobileDevice" class="mb-3 text-start fw-bolder fs-1">
Continue with:
</h1>
<div v-if="mobileDevice" class="text-start">
<a v-if="backToUrl" :href="backToUrl" class="back-btn"
>&#129144; Go back
</a>
<h1 class="mb-3 fw-bolder fs-1">Continue with:</h1>
</div>
<status-description
key="state.current"
:current-status="state.current"
Expand Down Expand Up @@ -239,7 +256,9 @@ <h1 v-if="mobileDevice" class="mb-3 text-start fw-bolder fs-1">
class="btn btn-primary mt-4"
v-on:click="socket.disconnect()"
title="Disconnect Websocket"
>DEBUG Disconnect Web Socket</button>
>
DEBUG Disconnect Web Socket
</button>
</div>

<hr v-if="mobileDevice" />
Expand Down Expand Up @@ -449,6 +468,12 @@ <h5 v-if="state.showScanned" class="fw-bolder mb-3">
socket: null,
};
},
computed: {
backToUrl() {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get("back_to_url");
},
},
methods: {
deepLinkOpen() {
this.setUiStates("pending");
Expand Down

0 comments on commit a56f232

Please sign in to comment.