Hi AF team,

We need to extend the app factory-authentication-plugin you have written to
do some changes at the time of authenticating users to jenkins web
interface. We only need to override the authenticate() method. But, there
are some private methods used by the authenticate() method. So I cannot
extend the CarbonSecurityRealm class.

I have locally made the necessary method protected and then wrote a new
plugin extending yours and it works as expected (builds etc. and UI access
both).

Shall I go ahead and commit the changes to your code? Following is the diff.

Index: src/main/java/org/jenkins/wso2/appfactory/CarbonSecurityRealm.java

===================================================================

--- src/main/java/org/jenkins/wso2/appfactory/CarbonSecurityRealm.java
(revision
204181)

+++ src/main/java/org/jenkins/wso2/appfactory/CarbonSecurityRealm.java (working
copy)

@@ -127,14 +127,14 @@

     return userDetails;

     }



-    private UserDetails createUserDetails(String username, String
password) {

+    protected UserDetails createUserDetails(String username, String
password) {

         GrantedAuthority[] authorities =

                 new
GrantedAuthority[]{SecurityRealm.AUTHENTICATED_AUTHORITY};



         return new CarbonUserDetails(username, password, authorities);

     }



-    private boolean isJenkinsSystemUser(String userName) {

+    protected boolean isJenkinsSystemUser(String userName) {

     String adminUsername = "";

     try {

     adminUsername =
AppFactoryUtil.getAppfactoryConfiguration().getFirstProperty(JENKINS_SERVER_ADMIN_USERNAME);

@@ -144,7 +144,7 @@

         return adminUsername.equals(userName);

     }



-    private boolean authenticateJenkinsSystemUser(String password) {

+    protected boolean authenticateJenkinsSystemUser(String password) {

     String adminPassword = "";

     try {


-- 
*Amila Maharachchi*
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: +94719371446
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to