Where do I find the IdentityProvider

Options

I want to implement this code on my servlet:
IdentityProvider.getService().getAuthorizedUser(otagtoken);

However I am able to locate this resource (IdentityProvider) - is there a jar available that I can download? Preferably a maven dependency I can register.

Thanks,
Brian

Comments

  • It's in otag-server-common.jar, which is part of the AppWorks install (i.e. it goes in your tomcat's lib directory when you unzip the appworks installer).

  • Great - thanks!

  • @John Wilkinson - tried a couple of things, updated my maven pom to include the jar you mentioned (otag-server-common.jar) first with a scope of provided, then tried to package the jar along with the service. Both failed.

    In the first approach using the provided scope i was hoping that my app would use the one in the tomcat lib directory - unfortunately this did not work. my app was unable to resolve the resource and threw a class not found exception; this is for the IdentityProvider class.

    I then decided to package the jar you mentioned along with my app, this lead to other more obscure errors implying that there was a conflict in libraries loaded in the tomcat runtime.

    Can you suggest the intended packaging strategy for using the IdentityProvider? I am having a hard time using it, my app currently needs to identify the AppWorks logged on user. I am able to get the user token in the application, just need to resolve it to a userName in my service.

    This really would be a lot easier if this resource was configured to work with maven or something comparable.

    Thanks!

  • I believe my problem is a conflict in the classpath - i opened up the otag-server-common.jar and quickly gave up, not sure there is a whole lot i can do there (embedded libraries with no version numbers).

    I am looking for an alternative, is there an existing RESTFul API to resolve the user and its roles, perhaps in the Gateway? This approach would be way cleaner. Any help or other suggestions would be much appreciated.

    Cheers...

  • To answer your last question, we don't have a REST api to get a user identity from an otagtoken.

    If you are running on an appworks server, the class is available. You should definitely not package it with your service.

    When you are testing your service and seeing the class-not-found exception, have you deployed it to a functioning AppWorks via the admin install tab, or are you testing in a dev environment (e.g. Eclipse)? Or is it just that the maven -based build is failing? If it's the latter, you need to include otag-server-common.jar as a non-shipping library, i.e. it must be present in the classpath to build against, but not included in your .war/.zip.

  • John, like i mentioned before - things start to get ugly when i include the jar file in my classpath to compile. for one reason or another my unit test start to fail when i add the dependency as provided.

    here is an example of what happens:
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DSMManagerImpl' defined in file [C:\dev\projects\AppworksService\target\classes\com\gxs\manager\impl\DSMManagerImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.gxs.manager.impl.DSMManagerImpl]: Constructor threw exception; nested exception is java.lang.NoSuchFieldError: INSTANCE

    I believe this is a result of a conflict of library versions - but like i mentioned before it is hard for me to distinguish what libraries are conflicting due to the way the otag-server-common.jar was packaged.

    I will push through and see what i can do - it would be nice for identity call to be decoupled from this dependency. things are starting to get messy.

    Cheers,
    Brian

  • is there some source code i can look at? i would like to see what the call actually does and try and create a stripped down version of the feature.

  • John,

    I have another update. To get things cleaned up i took the following actions:

    1) downgraded my JDK from 7 to 6 (i was getting some incompatibility errors compiling with 7)
    2) repackaged otag-server-common.jar - i only included the core opentext package, excluding all third party libraries.
    3) Included the otag-server-common library and marked it as provided
    4) added some additional otag-server-common dependencies and also marked them as provided

    This did solve my issue with compiling and running my unit test but unfortunately these actions lead to another issue when i deployed using the gateway app:

    Any thoughts?

    javax.ws.rs.WebApplicationException
    com.opentext.otag.auth.IdentityService.getAuthorizedUser(IdentityService.java:443)
    com.opentext.otag.auth.IdentityService.getAuthorizedUser(IdentityService.java:422)
    com.gxs.controller.RestController.getUser(RestController.java:41)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:606)
    org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
    org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748)
    org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
    org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    com.gxs.util.AccessControlFilter.doFilterInternal(AccessControlFilter.java:21)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    com.opentext.otag.rest.apps.AppFilter.doFilter(AppFilter.java:99)

  • ok - i believe i managed to resolve my issues, the last stack trace was just for an invalid user token. all works well with a valid one.

    thanks for the help