Search code examples
liferay

Can not find symbol class "OpenIdConnectProviderRegistry" & "OpenIdConnectUserInfoProcessor"


I am upgrading to Liferay 7.4 GA112 version from Liferay 7.2. We have configured Keycloak with Liferay for user login. However, upon upgrade I have found that these two classes are deprecated.

com.liferay.portal.security.sso.openid.connect.OpenIdConnectProviderRegistry import com.liferay.portal.security.sso.openid.connect.internal.OpenIdConnectUserInfoProcessor

I have tried to look into the source code, but not able to find.

  1. I am using OpenIdConnectProviderRegistry class to get the open-id-connect-provider-name (getOpenIdConnectProviderNames()).

  2. I have changed OpenIdConnectUserInfoProcessor to OIDCUserInfoProcessor but I am keep on getting com.liferay.portal.kernel.log.LogSanitizerException: org.osgi.framework.BundleException: Could not resolve module: com.exg.smc.portal.security.sso.oidc [1628]_ Unresolved requirement: Import-Package: com.liferay.portal.security.sso.openid.connect.internal_ [Sanitized] exception. However, I have added the correct dependency in build.gradle. This is how my bnd.bnd and build.gradle look like: build.gradle

bnd.bnd


Solution

  • from this issue:

    This class has been removed from latest Portal, the current workaround is to fetch ProviderMetadata and ClientInformation through, OAuthClientASLocalMetadataService, and OAuthClientEntryService.

    In future, we plan to implement new OAuth Client APIs, something like:

    interface OAuthClientRegistry {
        OAuthClient getOAuthClient();
    }
    interface OAuthClient {
        void requestAuthorization();
        Tokens requestTokens();
        OAuthClientInfo getInfo();
    }
    

    You should compile with the actual target-version in your gradle workspace (e.g. GA112). I assume the class won't be there, and the code will not compile.

    Also, you shouldn't need to compile any custom code to interface with Keycloak.