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

Display User Given Icon in the Login Editor for Custom Local Authenticators #7594

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/cyan-frogs-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.identity-providers.v1": patch
---

Display User Given Icon in the Login Editor for Custom Local Authenticators
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,15 @@ export interface LocalAuthenticatorInterface extends CommonPluggableComponentInt
*/
displayName?: string;
/**
* Description for the local authenticator.
* Description of the local authenticator.
* This property is used only with custom local authenticators.
*/
description?: string;
/**
* Image URI of the local authenticator.
* This property is used only with custom local authenticators.
*/
image?: string;
/**
* Is authenticator enabled.
*/
Expand All @@ -452,7 +457,7 @@ export interface LocalAuthenticatorInterface extends CommonPluggableComponentInt
* Authenticator Type.
* @example [ LOCAL, REQUEST_PATH ]
*/
type?: string;
type?: string;
/**
* Details endpoint.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,29 @@ export class IdentityProviderManagementUtils {
return authenticator?.tags?.includes("Custom");
};

/**
* Resolves the image of the local authenticator.
*
* For system defined user authenticators, the function retrieves the default icon.
* For custom local authenticators, it returns the authenticator's own image URI if available,
* or falls back to a default custom authenticator icon.
*
* @param authenticator - Authenticator.
* @returns image URI of the authenticator.
*/
const resolveLocalAuthenticatorImage = (authenticator: LocalAuthenticatorInterface): string => {
if (!isCustomLocalAuthenticator(authenticator)) {
AuthenticatorMeta.getAuthenticatorIcon(authenticator.id);
}

// Resolve image URI of custom local authenticators.
if (authenticator?.image) {
return authenticator.image;
} else {
AuthenticatorMeta.getCustomAuthenticatorIcon();
}
Shenali-SJ marked this conversation as resolved.
Show resolved Hide resolved
};

return axios.all(getPromises())
.then(axios.spread((local: LocalAuthenticatorInterface[],
federated: IdentityProviderListResponseInterface) => {
Expand Down Expand Up @@ -169,9 +192,7 @@ export class IdentityProviderManagementUtils {
displayName: authenticator.displayName,
id: authenticator.id,
idp: LocalAuthenticatorConstants.LOCAL_IDP_IDENTIFIER,
image: isCustomLocalAuthenticator(authenticator) ?
AuthenticatorMeta.getCustomAuthenticatorIcon() :
AuthenticatorMeta.getAuthenticatorIcon(authenticator.id),
image: resolveLocalAuthenticatorImage(authenticator),
isEnabled: authenticator.isEnabled,
name: authenticator.name
});
Expand Down
Loading