h-mdm/hmdm-server

plugin.audit.action.api.login - Error

sah-anshu opened this issue · 3 comments

Hi Guys,
I am unable to Login using rest API.
I am trying to POST to http://Server_URL/rest/public/jwt/login using JSON format of Username and MD5 Password.

{
"login": "xxxxxx",
"password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

But Still i get Unauth. Error. and Same time when i see Audit Log i see plugin.audit.action.api.login - Error

Please help how to fix this.

Regards
Anshu

h-mdm commented

Please try to convert password to uppercase, this should help.

Hi, I have tried the same but It is not working:

  • Changed Admin Password to Uppercase Password
  • Created MD5 of Uppercased password and tried in JSON
    {
    "login": "admin",
    "password": "xxxxxx"
    }

Please find the Logs below:

Jun 19 13:28:22 instance-2 tomcat9[32548]: 2022-06-19 13:28:22 [ERROR] JWTAuth : Unexpected error when authenticating user
Jun 19 13:28:22 instance-2 tomcat9[32548]: java.lang.NullPointerException
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.hmdm.security.jwt.rest.JWTAuthResource.login(JWTAuthResource.java:116)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at java.base/java.lang.reflect.Method.invoke(Method.java:566)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFacto
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.jav
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMetho
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.j
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.servlet.ServletContainer.serviceImpl(ServletContainer.java:408)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:583)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:524)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:461)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:89)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.hmdm.plugins.audit.rest.filter.ResourceAuditor.doProcess(ResourceAuditor.java:99)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.hmdm.plugins.audit.rest.filter.AuditFilter.doFilter(AuditFilter.java:123)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.hmdm.rest.filter.ApiOriginFilter.doFilter(ApiOriginFilter.java:52)
Jun 19 13:28:22 instance-2 tomcat9[32548]: at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)

h-mdm commented

NPE at that line of code means the credentials are not sent at all. Please make sure you're sending the request properly. Use Chrome's Advanced Rest Client for tests: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo