Skip to content

Commit

Permalink
Add a link to user information on oidc server
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Feb 5, 2025
1 parent fe39087 commit 5a92207
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/auth/FormElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default class GmfAuthForm extends GmfBaseElement {
@state() private twoFactorAuth = false;
@state() private allowPasswordChange = false;
@state() private allowPasswordReset = false;
@state() private oidcUserInformationUrl = '';
@state() private changingPassword = false;
@state() private userMustChangeItsPassword = false;
@state() private openIdConnectUrl = '';
Expand Down Expand Up @@ -122,6 +123,7 @@ export default class GmfAuthForm extends GmfBaseElement {
this.twoFactorAuth = configuration.gmfTwoFactorAuth;
this.allowPasswordChange = configuration.gmfAuthenticationConfig.allowPasswordChange;
this.allowPasswordReset = configuration.gmfAuthenticationConfig.allowPasswordReset;
this.oidcUserInformationUrl = configuration.gmfAuthenticationConfig.oidcUserInformationUrl;
this.openIdConnectBaseUrl = configuration.gmfOidcLoginUrl;
if (configuration.gmfCustomCSS && configuration.gmfCustomCSS.authentication !== undefined) {
this.customCSS_ = configuration.gmfCustomCSS.authentication;
Expand Down Expand Up @@ -181,6 +183,17 @@ export default class GmfAuthForm extends GmfBaseElement {
<strong>${this.gmfUser.username}</strong>.
</div>
${this.oidcUserInformationUrl
? html`
<div class="form-group">
<span
><a href="${this.oidcUserInformationUrl}" target="_blank"
>${i18next.t('User information on the OIDC service')}</a
></span
>
</div>
`
: html``}
${!this.changingPassword
? html`
<form name="logoutForm" role="form" @submit=${(evt: Event) => this.logout(evt)}>
Expand Down
3 changes: 2 additions & 1 deletion src/options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2020-2024 Camptocamp SA
// Copyright (c) 2020-2025 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -672,6 +672,7 @@ export function buildStyle(styleDescriptor) {
* @property {boolean} allowPasswordReset Whether to show the password forgotten link. Default to true.
* @property {boolean} allowPasswordChange Whether to show the change password button. Default to true.
* You can also specify a `PasswordValidator` object to add constraint on user's new password.
* @property {string} [oidcUserInformationUrl] The URL of the OIDC server to allows the user to get his profile information.
*/

/**
Expand Down
6 changes: 5 additions & 1 deletion srcapi/store/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2020-2024 Camptocamp SA
// Copyright (c) 2020-2025 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
Expand Down Expand Up @@ -979,6 +979,10 @@ export type gmfAuthenticationConfig = {
* You can also specify a `PasswordValidator` object to add constraint on user's new password.
*/
allowPasswordChange: boolean;
/**
* The URL of the OIDC server to allows the user to get his profile information.
*/
oidcUserInformationUrl?: string;
};

/**
Expand Down

0 comments on commit 5a92207

Please sign in to comment.