-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GEOS-9083] Added back missing default master password warning.
- Loading branch information
Showing
3 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ty/core/src/test/java/org/geoserver/security/web/SecurityHomePageContentProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* (c) 2018 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
package org.geoserver.security.web; | ||
|
||
import org.geoserver.security.password.MasterPasswordProviderConfig; | ||
import org.junit.Test; | ||
|
||
public class SecurityHomePageContentProviderTest extends AbstractSecurityWicketTestSupport { | ||
|
||
@Test | ||
public void testMasterPasswordMessageWithLoginDisabled() throws Exception { | ||
checkMasterPasswordMessage(false); | ||
} | ||
|
||
@Test | ||
public void testMasterPasswordMessageWithLoginEnabled() throws Exception { | ||
checkMasterPasswordMessage(true); | ||
} | ||
|
||
private void checkMasterPasswordMessage(boolean loginEnabled) throws Exception { | ||
MasterPasswordProviderConfig masterPasswordConfig = | ||
getSecurityManager() | ||
.loadMasterPassswordProviderConfig( | ||
getSecurityManager().getMasterPasswordConfig().getProviderName()); | ||
masterPasswordConfig.setLoginEnabled(loginEnabled); | ||
getSecurityManager().saveMasterPasswordProviderConfig(masterPasswordConfig); | ||
tester.startComponentInPage( | ||
new SecurityHomePageContentProvider().getPageBodyComponent("swp")); | ||
tester.assertComponent("swp", SecurityHomePageContentProvider.SecurityWarningsPanel.class); | ||
tester.assertVisible("swp:mpmessage"); | ||
tester.assertVisible("swp:mplink"); | ||
} | ||
} |