Search code examples
liferayliferay-7

What's the best way to change the "OpenId Connect" link in the Liferay login page?


We have added several Social Logins to our Liferay 7.3 portal. These include the built-in Facebook and OpenId Connect capabilities as well as custom filters for Twitter, LinkedIn, and so on. OpenId Connect is configured for Google login.

This all works fine, but I need to change the link in the login page from "OpenId Connect" to "Google".

I have discovered that the value is set in the key open-id-connect-configuration-name in the language files in the portal-security-sso-openid-connect-api module. It is then accessed by the getName() method of the com.liferay.portal.settings.authentication.openid.connect.web.internal.portal.settings.configuration.admin.display.OpenIdConnectPortalSettingsConfigurationScreenContributor class. I believe this contributor supplies the value to the navigator for use as the label.

My question is what is the easiest and most maintainable way to go about changing this value? My thought was to supply alternate Language_*.properties files, but I'm not sure how to override the existing ones. Would a JSP hook of the portal-security-sso-openid-connect-api module allow me to do this?


Solution

  • I don't know a clean way - hopefully someone will chime in with one - but I had the same issue and had to solve it with a small piece of JavaScript in navigation.jspf:

    <script>
        $( document ).ready(function() {
            $(".taglib-text").filter(function () {
            return ($(this).text() === 'OpenId Connect')
        }).text("Google");
    });
    </script>
    

    While this works it's still a bit weird since clicking the link will go to the OpenId Connect portlet that has a drop down with a single item - Google - that is selected, and then the user has to click another Login button. I know this is to allow multiple OpenID Connect clients, but I'd sure like a direct method for Google.