Manual Build and Extension Installation

i have installed xwiki 11 on our dev environment. We have some requirements for OIDC and we have to make some code change in XWIKI OIDC repo code to pass custom parameters as query.

I have forked the repository and made the code change. Now i have build the project using maven and getting oidc-api-1.21.4-SNAPSHOT.jar.

Could someone please help, how i could install/place this jar in xwiki manually. i also tried to put this file manually into xwiki volume but this did not reflect in xwiki admin UI.

Is there any step which i am missing here.

There are several options.

The simplest is to install the standard extension (so that you get the dependencies automatically installed) and then replace the JAR of the extension located in /extension/repository (you will need to restart for this change to be taken into account).

The cleanest is probably to install your version as extension (so that it appear with its real version in the UI): to do this you will need to make some Maven repository which contains this JAR (works with a local Maven repository too, basically you just need a directory which contains the jar/pom files in the right path) available to your XWiki instance but indicating it in the xwiki.properties file (see extension.repositories property documentation in there).

Of course the best would be to not patch this JAR at all and instead contribute some way in the standard version to set custom parameters in the configuration.

Thank you for detail information. I have made the code change after fork the repo. And its working for 1st step to validate the client id and client secret.

However while validating token still i am getting redirect url with port ( http://redirecturl:port ) . Could you please help to find file where it set the redirect url for second call.

@tmortagne , Could you please also suggest where i could make the code change in XWiki OIDC for the second call.

I you suggested i made the code change in https://github.com/xwiki-contrib/oidc/blob/d2e44cb86ae1ea8d40f4737b9f38b0dcd3a2f91a/oidc-authenticator/src/main/java/org/xwiki/contrib/oidc/auth/OIDCAuthServiceImpl.java#L147 and its working fine for first call.

but now in second call for validate token its again sending port number as part of redirect url. So could you please suggest in which file in need to make the code change for redirect url for second call.

It does not make any sense to patch the OIDC authenticator to workaround this since this is a XWiki Standard problem and generally a setup one. “Fixing” the authenticator won’t fix all the others places in XWiki Standard which needs to generate a full URL to the XWiki instance.

@tmortagne , thanks for the suggestion. Currently we have install xwiki on kubernetes and expose it through service which having both port 80 and 443. I am not suer why XWiki is adding port 80 in redirect URL. Could you please refer any documentation which could help in debug.

It’s not specific to the redirect URL, you should reproduce the same thing by putting:

{{velocity}}
$doc.externalURL
{{/velocity}}

It generally means that the HTTP proxy you have in front of XWiki does not properly forward the port.