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
In the newer versions of Nexus (version >3.6), the getConfiguration() method from org.sonatype.nexus.security.realm.RealmConfiguration is no longer accessible (private method). This change is causing the following error:
{
"name" : "security_realm",
"result" : "javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype..security.internal.RealmManagerImpl$$EnhancerByGuice$$4cc466e.getConfiguration() is applicable for argument types: () values: []"
}
Why is this needed?
Change is needed to be able to use nexus-role with newer version of nexus
Additional Information
- Content length: '284'
- Content type: application/json
- Date: Wed, 08 May 2024 09:37:14 GMT
- Elapsed: 0
- JSON:
- name: security_realm
- result: 'javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.sonatype..security.internal.RealmManagerImpl$$EnhancerByGuice$$4cc466e.getConfiguration() is applicable for argument types: () values: []'
- Message: 'Status code was 400 and not [200, 204]: HTTP Error 400: Bad Request'
Proposed solution
realm.groovy ( files/scripts/security/realm.groovy) script is used to enable or disable a security realm in Nexus Repository Manager.
Currently the script is retrieving the RealConfiguration object from the RealmManager before enabling or disabling the realm. However, this is not necessary for the operation and can cause an error in newer versions of Nexus, as the getConfiguration() method may not be accessible or exist in the RealmManager interface.
The proposed solution is to remove the access to realmConfig and directly enables or disables the realm using the enableRealm method on the RealmManager object.
Proposed script:
import org.sonatype.nexus.security.realm.RealmManager
parsed_args = new JsonSlurper().parseText(args)
def realmManager = container.lookup(RealmManager.class.getName());
realmManager.enableRealm(parsed_args.name, parsed_args.enabled && parsed_args.enabled.toBoolean())```
This simplified version of the script should be compatible with more versions of Nexus, both old and new.
The text was updated successfully, but these errors were encountered:
Description
In the newer versions of Nexus (version >3.6), the
getConfiguration()
method fromorg.sonatype.nexus.security.realm.RealmConfiguration
is no longer accessible (private method). This change is causing the following error:Why is this needed?
Change is needed to be able to use nexus-role with newer version of nexus
Additional Information
Proposed solution
realm.groovy
( files/scripts/security/realm.groovy) script is used to enable or disable a security realm in Nexus Repository Manager.Currently the script is retrieving the
RealConfiguration
object from theRealmManager
before enabling or disabling the realm. However, this is not necessary for the operation and can cause an error in newer versions of Nexus, as thegetConfiguration()
method may not be accessible or exist in theRealmManager
interface.Existing script:
The proposed solution is to remove the access to
realmConfig
and directly enables or disables the realm using theenableRealm
method on theRealmManager
object.Proposed script:
The text was updated successfully, but these errors were encountered: