File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
main/java/opengrok/auth/plugin
test/java/opengrok/auth/plugin Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 30
30
import opengrok .auth .plugin .configuration .Configuration ;
31
31
import opengrok .auth .plugin .entity .User ;
32
32
import opengrok .auth .plugin .ldap .AbstractLdapProvider ;
33
- import opengrok .auth .plugin .ldap .FakeLdapFacade ;
34
33
import opengrok .auth .plugin .ldap .LdapFacade ;
35
34
import org .opengrok .indexer .authorization .IAuthorizationPlugin ;
36
35
import org .opengrok .indexer .configuration .Group ;
@@ -60,7 +59,6 @@ public abstract class AbstractLdapPlugin implements IAuthorizationPlugin {
60
59
public static long nextId = 1 ;
61
60
62
61
protected static final String CONFIGURATION_PARAM = "configuration" ;
63
- protected static final String FAKE_PARAM = "fake" ;
64
62
65
63
private static final String SESSION_PREFIX = "opengrok-abstract-ldap-plugin-" ;
66
64
protected String SESSION_USERNAME = SESSION_PREFIX + "username" ;
@@ -124,15 +122,8 @@ void load(AbstractLdapProvider provider) {
124
122
*/
125
123
@ Override
126
124
public void load (Map <String , Object > parameters ) {
127
- Boolean fake ;
128
125
String configurationPath ;
129
126
130
- if ((fake = (Boolean ) parameters .get (FAKE_PARAM )) != null
131
- && fake ) {
132
- ldapProvider = new FakeLdapFacade ();
133
- return ;
134
- }
135
-
136
127
if ((configurationPath = (String ) parameters .get (CONFIGURATION_PARAM )) == null ) {
137
128
throw new NullPointerException ("Missing param [" + CONFIGURATION_PARAM + "]" );
138
129
}
Original file line number Diff line number Diff line change @@ -76,10 +76,21 @@ public LdapAttrPlugin() {
76
76
sessionAllowed += "-" + nextId ++;
77
77
}
78
78
79
+ // for testing
80
+ void load (Map <String , Object > parameters , AbstractLdapProvider provider ) {
81
+ super .load (provider );
82
+
83
+ init (parameters );
84
+ }
85
+
79
86
@ Override
80
87
public void load (Map <String , Object > parameters ) {
81
88
super .load (parameters );
82
89
90
+ init (parameters );
91
+ }
92
+
93
+ void init (Map <String , Object > parameters ) {
83
94
if ((ldapAttr = (String ) parameters .get (ATTR_PARAM )) == null ) {
84
95
throw new NullPointerException ("Missing param [" + ATTR_PARAM + "] in the setup" );
85
96
}
Original file line number Diff line number Diff line change 37
37
import javax .servlet .http .HttpServletRequest ;
38
38
import opengrok .auth .entity .LdapUser ;
39
39
import opengrok .auth .plugin .entity .User ;
40
+ import opengrok .auth .plugin .ldap .FakeLdapFacade ;
40
41
import opengrok .auth .plugin .util .DummyHttpServletRequestLdap ;
41
42
import org .junit .AfterClass ;
42
43
import org .junit .Assert ;
@@ -73,11 +74,10 @@ public void setUp() {
73
74
plugin = new LdapAttrPlugin ();
74
75
Map <String , Object > parameters = new TreeMap <>();
75
76
76
- parameters .put (AbstractLdapPlugin .FAKE_PARAM , true );
77
77
parameters .put (LdapAttrPlugin .FILE_PARAM , whitelistFile .getAbsolutePath ());
78
78
parameters .put (LdapAttrPlugin .ATTR_PARAM , "mail" );
79
79
80
- plugin .load (parameters );
80
+ plugin .load (parameters , new FakeLdapFacade () );
81
81
}
82
82
83
83
@ SuppressWarnings ("unchecked" )
You can’t perform that action at this time.
0 commit comments