You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR 6255 --- [omcat-handler-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
java.lang.NullPointerException: Cannot invoke "String.substring(int)" because "authHeader" is null
at com.homihq.db2rest.auth.basic.BasicAuthProvider.authenticate(BasicAuthProvider.java:36) ~[auth-1.4.1.jar!/:1.4.1]
at com.homihq.db2rest.auth.AuthFilter.doFilterInternal(AuthFilter.java:46) ~[auth-1.4.1.jar!/:1.4.1]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.14.jar!/:6.1.14]
When try to use API key for POST data gives error "authHeader" is null. But can use API key with GET requests. DB2Rest version Version 1.4.1
auth.yml
name: db2rest-security
resourceRoles:
resource: "/v1/rdbms/db/inventory_SunVending/**"
method: post
roles:
resource: "/v1/rdbms/db//v1/rdbms/db/inventory_SunVending"
method: get
roles:
excludedResources:
method: get
method: put
method: delete
apiKeys:
roles: [role1]
active: true
POST
curl --request POST --url http://192.168.5.103:8080/v1/rdbms/db/inventory_SunVending --header 'X-API-KEY: Authkey1' --header 'Content-Type: application/json' --header 'User-Agent: insomnia/8.6.1' --data '{ "machine_id": "32372", "location_name": "VX0-7000100006-D1103-(รพ.รามาธิบดี อาคารพระเทพฯชั้น2)", "product_code": "123368", "product_name": "H.D. สตรอเบอร์รี่ลูกเกด", "max_quantity": "7", "remaining_amount": "5", "refill_quantity": "2", "remaining_products": "71.42857142857143 %", "product_price": "13", "sold_price": "12", "date": "17-01-2025 00:01:02" }'
{"type":"https://db2rest.com/error/generic-error","title":"Generic Data Access Error","status":400,"detail":"Database ID not found.","instance":"/error","errorCategory":"Data-access-error","timestamp":"2025-01-29T08:32:57.821874536Z"}
Error
ERROR 6255 --- [omcat-handler-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
java.lang.NullPointerException: Cannot invoke "String.substring(int)" because "authHeader" is null
at com.homihq.db2rest.auth.basic.BasicAuthProvider.authenticate(BasicAuthProvider.java:36) ~[auth-1.4.1.jar!/:1.4.1]
at com.homihq.db2rest.auth.AuthFilter.doFilterInternal(AuthFilter.java:46) ~[auth-1.4.1.jar!/:1.4.1]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.1.14.jar!/:6.1.14]
GET
curl --request GET --url http://192.168.5.103:8080/v1/rdbms/db/inventory_SunVending?filter=date=gt=16-01-2025 --header 'Accept-Profile: ' --header 'User-Agent: insomnia/8.4.5' --header 'X-API-KEY: Authkey1'
Results as expected.
The text was updated successfully, but these errors were encountered: