Skip to content

Commit

Permalink
Added pres_req_conf_id as an option (#11)
Browse files Browse the repository at this point in the history
* feat: added pres_req_conf_id to the auth callout

* feat: added ignore

* feat: added git sign
  • Loading branch information
arcshiftsolutions authored Sep 26, 2023
1 parent 1e90385 commit 2e3b7e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
10 changes: 10 additions & 0 deletions playground/public-spa/components/Configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ export default function Configuration({ kcConfig, setKcConfig, loginOptions, set
defaultValue={loginOptionsData?.scope}
/>
</Form.Field>
<Form.Field>
<label>Verifiable Credential Configuration ID</label>
<Form.Input
placeholder=""
type="text"
onChange={handleLoginOptionsChange}
name="pres_req_conf_id"
defaultValue={loginOptionsData?.pres_req_conf_id}
/>
</Form.Field>
{/* <Form.Field>
<label>PKCE Method</label>
<Form.Input
Expand Down
1 change: 1 addition & 0 deletions playground/public-spa/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function MyApp({ Component, pageProps }: AppProps) {
redirectUri: sso_redirect_uri,
idpHint: '',
scope: 'openid',
pres_req_conf_id: ''
},
);

Expand Down
15 changes: 13 additions & 2 deletions playground/public-spa/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ interface Props {
}

const Home = ({ keycloak, kcConfig, setKcConfig, loginOptions, setLginOptions }: Props) => {
const handleLogin = () => keycloak?.login(loginOptions);
const handleLogin = () => {
// @ts-ignore
if(loginOptions.pres_req_conf_id){
var loginURL = keycloak?.createLoginUrl(loginOptions);
if(loginURL){
// @ts-ignore
window.location.href = loginURL + '&pres_req_conf_id=' + loginOptions.pres_req_conf_id;
};
}else{
keycloak?.login(loginOptions);
}
};
const handleLogout = () => {
window.location.href = `https://logon7.gov.bc.ca/clp-cgi/logoff.cgi?retnow=1&returl=${encodeURIComponent(
`${kcConfig.url}/realms/${kcConfig.realm}/protocol/openid-connect/logout?post_logout_redirect_uri=` +
loginOptions.redirectUri +
'&id_token_hint=' +
keycloak.idToken,
keycloak.idToken,
)}`;
};
return (
Expand Down

0 comments on commit 2e3b7e4

Please sign in to comment.