This repository was archived by the owner on May 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 594
This repository was archived by the owner on May 14, 2025. It is now read-only.
NullPointer throw when authenticate via Bearer Token to active endpoint i.e. register application #4861
Copy link
Copy link
Closed
Description
I've configured SCDF to use ADFS nad OAuth2.0. When user login to SCDF everything is fine, but when I want to call REST API to register new application I've got NullPointer:
curl -vik -H "Authorization: Bearer %TOKEN%" https://localhost:9445/apps/task/my-task-process/1.7.4.90-SNAPSHOT -d "uri=docker%3Aeu.gcr.io%2Fmy-project-gcp%2Fmy-task-process%3A1.7.4.90-SNAPSHOT&force=true"
While debug I noticed that it's caused by getCurrentAuditor method because when I authorize via client, there is no user info.
2022-03-23 14:48:04.419 TRACE 5132 --- [nio-9445-exec-9] o.s.s.w.a.i.FilterSecurityInterceptor : Did not re-authenticate JwtAuthenticationToken [Principal=org.springframework.security.oauth2.jwt.Jwt@6bc00fb2, Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=127.0.0.1, SessionId=null], Granted Authorities=[ROLE_CREATE, ROLE_MANAGE, ROLE_DEPLOY, ROLE_MODIFY, ROLE_DESTROY, ROLE_SCHEDULE, ROLE_VIEW]] before authorizing
2022-03-23 14:48:04.419 TRACE 5132 --- [nio-9445-exec-9] o.s.s.w.a.i.FilterSecurityInterceptor : Authorizing filter invocation [POST /apps/task/my-task-process/1.7.4.90-SNAPSHOT] with attributes [hasRole('ROLE_CREATE')]
2022-03-23 14:48:04.419 DEBUG 5132 --- [nio-9445-exec-9] o.s.s.w.a.i.FilterSecurityInterceptor : Authorized filter invocation [POST /apps/task/my-task-process/1.7.4.90-SNAPSHOT] with attributes [hasRole('ROLE_CREATE')]
2022-03-23 14:48:04.419 TRACE 5132 --- [nio-9445-exec-9] o.s.s.w.a.i.FilterSecurityInterceptor : Did not switch RunAs authentication since RunAsManager returned null
2022-03-23 14:48:04.419 DEBUG 5132 --- [nio-9445-exec-9] o.s.security.web.FilterChainProxy : Secured POST /apps/task/my-task-process/1.7.4.90-SNAPSHOT
2022-03-23 14:48:46.327 ERROR 5132 --- [nio-9445-exec-9] o.s.c.d.s.c.RestControllerAdvice : Caught exception while handling a request
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:221)
at java.base/java.util.Optional.<init>(Optional.java:107)
at java.base/java.util.Optional.of(Optional.java:120)
at org.springframework.cloud.dataflow.server.service.SpringSecurityAuditorAware.getCurrentAuditor(SpringSecurityAuditorAware.java:45)
at java.base/java.util.Optional.map(Optional.java:265)
at org.springframework.data.auditing.AuditingHandler.getAuditor(AuditingHandler.java:109)
at org.springframework.data.auditing.AuditingHandler.markCreated(AuditingHandler.java:92)
at org.springframework.data.jpa.domain.support.AuditingEntityListener.touchForCreate(AuditingEntityListener.java:92)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.hibernate.jpa.event.internal.ListenerCallback.performCallback(ListenerCallback.java:35)
at org.hibernate.jpa.event.internal.CallbackRegistryImpl.callback(CallbackRegistryImpl.java:95)
at org.hibernate.jpa.event.internal.CallbackRegistryImpl.preCreate(CallbackRegistryImpl.java:55)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
Metadata
Metadata
Assignees
Labels
type/bugIs a bug reportIs a bug report