Incorrect code inspection errors with AuthProviderPluginClass

Issue #1753 resolved
Aidan Harding created an issue

I think that there are a few cases where Salesforce returns unhelpful metadata about system classes and this seems to be one of them.

In the past (< v39.0), if you wanted to write a AuthProviderPluginClass, then you would implement the AuthProviderPlugin interface. Now, you need to extend the AuthProviderPluginClass instead.

I can’t see it because it’s hidden inside the system, but it looks like AuthProviderPluginClass implements AuthProviderPlugin.

But, in the OST, all the required methods look like they just live in AuthProviderPluginClass

The end result is that when I write my class extending AuthProviderPluginClass, Illuminated Cloud thinks that some of my method require the override keyword, when the compiler insists that they must not.

So, an example like this:

public with sharing class DummyAuthProvider extends Auth.AuthProviderPluginClass {

    public String getCustomMetadataType() {
        return null;
    }

    public Auth.UserData getUserInfo(Map<String, String> authProviderConfiguration, Auth.AuthProviderTokenResponse response) {
        return null;
    }

    public Auth.AuthProviderTokenResponse handleCallback(Map<String, String> authProviderConfiguration, Auth.AuthProviderCallbackState callbackState) {
        return null;
    }

    public PageReference initiate(Map<String, String> authProviderConfiguration, String stateToPropagate) {
        return null;
    }

    public override Auth.OAuthRefreshResult refresh(Map<String, String> authProviderConfiguration, String refreshToken) {
        return null;
    }
}

Is valid Apex, but all the methods without override are marked as errors by the code inspector.

Comments (2)

  1. Scott Wells repo owner

    Fix committed for inclusion in the next release. You will need to regenerate your OST after taking delivery of that build after which the OST's version of Auth.AuthProviderPluginClass will be:

    global class /*Auth.*/AuthProviderPluginClass implements Auth.AuthProviderPlugin
    {
        global virtual Auth.OAuthRefreshResult refresh(Map<String, String> authProviderConfiguration, String refreshToken)
        {
        }
    }
    

    and a class like the following can be created simply by extending that base class and using IC's implement/override methods action (or the code intention to fix an incomplete concrete class):

    public with sharing class Issue1753 extends Auth.AuthProviderPluginClass
    {
        public String getCustomMetadataType()
        {
            return '';
        }
    
        public Auth.UserData getUserInfo(Map<String, String> authProviderConfiguration, Auth.AuthProviderTokenResponse response)
        {
            return null;
        }
    
        public Auth.AuthProviderTokenResponse handleCallback(Map<String, String> authProviderConfiguration, Auth.AuthProviderCallbackState callbackState)
        {
            return null;
        }
    
        public PageReference initiate(Map<String, String> authProviderConfiguration, String stateToPropagate)
        {
            return null;
        }
    
        public override Auth.OAuthRefreshResult refresh(Map<String, String> authProviderConfiguration, String refreshToken)
        {
            return super.refresh(authProviderConfiguration, refreshToken);
        }
    }
    
  2. Log in to comment