I was exploring that option, but the Client Interception script is not triggering the updateClient function where we can have access to the registerRequest parameter.
I was trying below simple script just to print out the data just and understand what's available, but I am seeing in the logs that only init is triggered. Am I missing something?
oxauth_script.log
```
2020-08-11 08:26:12,242 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - RPT Policy. Destroyed successfully
2020-08-11 08:26:12,274 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - RPT Policy. Initializing ...
2020-08-11 08:26:12,274 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - RPT Policy. Initialized successfully
2020-08-11 08:26:12,279 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Permission dynamic scope. Destroy
2020-08-11 08:26:12,279 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Permission dynamic scope. Destroyed successfully
2020-08-11 08:26:12,289 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Permission dynamic scope. Initialization
2020-08-11 08:26:12,290 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Permission dynamic scope. Initialized successfully
2020-08-11 08:26:12,301 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Client registration. Initialization
2020-08-11 08:26:12,301 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Client registration. Initialized successfully
2020-08-11 08:26:12,307 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Casa client registration. Destroy
2020-08-11 08:26:12,307 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Casa client registration. Destroyed successfully
2020-08-11 08:26:12,324 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Casa client registration. Initialization
2020-08-11 08:26:12,324 INFO [oxAuthScheduler_Worker-2] [org.gluu.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Casa client registration. Initialized successfully
```
oxauth.log
```
2020-08-11 08:31:44,826 ERROR [qtp1625082366-21] [gluu.oxauth.register.ws.rs.RegisterRestWebServiceImpl] (RegisterRestWebServiceImpl.java:340) - A JSONObject text must begin with '{' at 1 [character 2 line 1]
org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
at org.json.JSONTokener.syntaxError(JSONTokener.java:505) ~[json-20180813.jar:?]
at org.json.JSONObject.<init>(JSONObject.java:215) ~[json-20180813.jar:?]
at org.json.JSONObject.<init>(JSONObject.java:399) ~[json-20180813.jar:?]
at org.gluu.oxauth.register.ws.rs.RegisterRestWebServiceImpl.registerClientImpl(RegisterRestWebServiceImpl.java:143) ~[classes/:?]
at org.gluu.oxauth.register.ws.rs.RegisterRestWebServiceImpl.requestRegister(RegisterRestWebServiceImpl.java:133) ~[classes/:?]
at org.gluu.oxauth.register.ws.rs.RegisterRestWebServiceImpl$Proxy$_$$_WeldClientProxy.requestRegister(Unknown Source) ~[classes/:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:138) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:535) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:424) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:385) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:356) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:387) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:356) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:329) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:356) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) ~[resteasy-jaxrs-3.11.2.Final.jar:3.11.2.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[servlet-api-3.1.jar:3.1.0]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1617) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:226) ~[websocket-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.gluu.server.filters.AbstractCorsFilter.handleNonCORS(AbstractCorsFilter.java:362) ~[oxcore-server-4.2.0.Final.jar:?]
at org.gluu.server.filters.AbstractCorsFilter.doFilter(AbstractCorsFilter.java:139) ~[oxcore-server-4.2.0.Final.jar:?]
at org.gluu.oxauth.filter.CorsFilter.doFilter(CorsFilter.java:118) ~[classes/:?]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.gluu.oxauth.audit.debug.ServletLoggingFilter.doFilter(ServletLoggingFilter.java:67) ~[classes/:?]
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1596) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:545) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590) ~[jetty-security-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485) ~[jetty-servlet-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.Server.handle(Server.java:500) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) ~[jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) [jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) [jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270) [jetty-server-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [jetty-io-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.26.v20200117.jar:9.4.26.v20200117]
at java.lang.Thread.run(Thread.java:834) [?:?]
```
Client Registration Interception Script
```
from org.gluu.model.custom.script.type.client import ClientRegistrationType
from org.gluu.service.cdi.util import CdiUtil
from org.gluu.oxauth.service import ScopeService
from org.gluu.util import StringHelper, ArrayHelper
from java.util import Arrays, ArrayList, HashSet
import java
class ClientRegistration(ClientRegistrationType):
def __init__(self, currentTimeMillis):
self.currentTimeMillis = currentTimeMillis
def init(self, customScript, configurationAttributes):
print "Client registration. Initialization"
print "Client registration. Initialized successfully"
return True
def destroy(self, configurationAttributes):
print "Client registration. Destroy"
print "Client registration. Destroyed successfully"
return True
# Update client entry before persistent it
# registerRequest is org.gluu.oxauth.client.RegisterRequest
# client is org.gluu.oxauth.model.registration.Client
# configurationAttributes is java.util.Map<String, SimpleCustomProperty>
def createClient(self, registerRequest, client, configurationAttributes):
print "Client registration. CreateClient method"
return True
# Update client entry before persistent it
# registerRequest is org.gluu.oxauth.client.RegisterRequest
# client is org.gluu.oxauth.model.registration.Client
# configurationAttributes is java.util.Map<String, SimpleCustomProperty>
def updateClient(self, registerRequest, client, configurationAttributes):
print "Client registration. UpdateClient method"
return True
def getApiVersion(self):
return 11
```