lucasimone

ArcGIS Server 10.2.1 Custom Identity Store completely broken

Discussion created by lucasimone on Mar 14, 2014
Ok esri, this is really odd, since 10.1 my custom identity store written in Java was working fine.
It's really simple, only a connector to our custom users/roles that are store in sql server with a custom schema.

Then comes 10.2.1, and now it's impossible to set a new security store, the admin interface just give me: '500 Servlet execution threw an exception'

Nothing more, it's impossible to find out what the real problem is.

Fun story:

Another fun fact, the guide at: http://resources.arcgis.com/en/help/main/10.2/index.html#//01540000058z000000 says that you have to implement 2 interfaces, UserStore and RoleStore, easy.
I've done 2 separated classes one implements UserStore and the other implements RoleStore...but at ESRI someone hates me.
After you have copied the jar on the arcgis server, the admin interface thrown me another error:

com.foo.bar.MyUserStore does not implement UserStore

What? Turns out that the problem is...inside the arcgis-admin.jar

Yes, because after a quick decompile I have found that, IdentityStoreFactory is used to load the UserStore, and inside this factory:
public static synchronized UserStore getUserStore(IdentityStoreConfig userStoreConfig, boolean initialize) throws Exception {


Someone had just copied and pasted from the wrong method:

switch (0.a[localObject1.ordinal()])
    {
    case 1: 
      String str1 = userStoreConfig.getClassName();
      if (str1 == null) {
        throw new Exception(AgsadminLogCode.MISSING_CLASS_ATTR_IN_USER_STORE.message());
      }
      Object localObject4 = Class.forName(str1).newInstance();
      if (!(localObject4 instanceof RoleStore)) {
        throw new Exception(AgsadminLogCode.USERSTORE_ITF_NOT_IMPL.params(new Object[] { str1 }).message());
      }
      localObject3 = (UserStore)localObject4;
      break;


Shouldn't be UserStore instanceof UserStore instead of:

if (!(localObject4 instanceof RoleStore)) {


The example that comes with the arcgis server works...because there's only one class that implements these 2 interfaces.

Outcomes