Update docs / fix hash algorithms task / fix unit tests

- From a common session wit sgdc3
This commit is contained in:
ljacqu 2016-10-01 23:43:37 +02:00
parent 62b8af6a37
commit 74a61188f5
5 changed files with 23 additions and 15 deletions

View File

@ -1,5 +1,5 @@
<!-- AUTO-GENERATED FILE! Do not edit this directly --> <!-- AUTO-GENERATED FILE! Do not edit this directly -->
<!-- File auto-generated on Wed Jun 22 17:39:14 EDT 2016. See commands/commands.tpl.md --> <!-- File auto-generated on Sat Oct 01 23:33:39 CEST 2016. See commands/commands.tpl.md -->
## AuthMe Commands ## AuthMe Commands
You can use the following commands to use the features of AuthMe. Mandatory arguments are marked with `< >` You can use the following commands to use the features of AuthMe. Mandatory arguments are marked with `< >`
@ -32,7 +32,7 @@ brackets; optional arguments are enclosed in square brackets (`[ ]`).
<br />Requires `authme.admin.firstspawn` <br />Requires `authme.admin.firstspawn`
- **/authme setfirstspawn**: Change the first player's spawn to your current position. - **/authme setfirstspawn**: Change the first player's spawn to your current position.
<br />Requires `authme.admin.setfirstspawn` <br />Requires `authme.admin.setfirstspawn`
- **/authme purge** &lt;days>: Purge old AuthMeReloaded data longer than the specified amount of days ago. - **/authme purge** &lt;days> [all]: Purge old AuthMeReloaded data longer than the specified amount of days ago.
<br />Requires `authme.admin.purge` <br />Requires `authme.admin.purge`
- **/authme resetpos** &lt;player/*>: Purge the last know position of the specified player or all of them. - **/authme resetpos** &lt;player/*>: Purge the last know position of the specified player or all of them.
<br />Requires `authme.admin.purgelastpos` <br />Requires `authme.admin.purgelastpos`
@ -66,7 +66,7 @@ brackets; optional arguments are enclosed in square brackets (`[ ]`).
<br />Requires `authme.player.email.add` <br />Requires `authme.player.email.add`
- **/email change** &lt;oldEmail> &lt;newEmail>: Change an email address of your account. - **/email change** &lt;oldEmail> &lt;newEmail>: Change an email address of your account.
<br />Requires `authme.player.email.change` <br />Requires `authme.player.email.change`
- **/email recover** &lt;email>: Recover your account using an Email address by sending a mail containing a new password. - **/email recover** &lt;email> [code]: Recover your account using an Email address by sending a mail containing a new password.
<br />Requires `authme.player.email.recover` <br />Requires `authme.player.email.recover`
- **/email help** [query]: View detailed help for /email commands. - **/email help** [query]: View detailed help for /email commands.
- **/captcha** &lt;captcha>: Captcha command for AuthMeReloaded. - **/captcha** &lt;captcha>: Captcha command for AuthMeReloaded.
@ -76,4 +76,4 @@ brackets; optional arguments are enclosed in square brackets (`[ ]`).
--- ---
This page was automatically generated on the [AuthMe-Team/AuthMeReloaded repository](https://github.com/AuthMe-Team/AuthMeReloaded/tree/master/docs/) on Wed Jun 22 17:39:14 EDT 2016 This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sat Oct 01 23:33:39 CEST 2016

View File

@ -1,5 +1,5 @@
<!-- AUTO-GENERATED FILE! Do not edit this directly --> <!-- AUTO-GENERATED FILE! Do not edit this directly -->
<!-- File auto-generated on Wed Jun 22 17:39:16 EDT 2016. See hashmethods/hash_algorithms.tpl.md --> <!-- File auto-generated on Sat Oct 01 23:42:20 CEST 2016. See hashmethods/hash_algorithms.tpl.md -->
## Hash Algorithms ## Hash Algorithms
AuthMe supports the following hash algorithms for storing your passwords safely. AuthMe supports the following hash algorithms for storing your passwords safely.
@ -17,7 +17,7 @@ JOOMLA | Recommended | 65 | | | Text | 32 |
MD5 | Do not use | 32 | | | None | | MD5 | Do not use | 32 | | | None | |
MD5VB | Acceptable | 56 | | | Text | 16 | MD5VB | Acceptable | 56 | | | Text | 16 |
MYBB | Acceptable | 32 | | | Text | 8 | Y MYBB | Acceptable | 32 | | | Text | 8 | Y
PBKDF2 | Does not work | 328 | | | Text | 12 | PBKDF2 | Does not work | 332 | | | Text | 12 |
PBKDF2DJANGO | Acceptable | 77 | Y | | Text | 12 | PBKDF2DJANGO | Acceptable | 77 | Y | | Text | 12 |
PHPBB | Acceptable | 34 | | | Text | 16 | PHPBB | Acceptable | 34 | | | Text | 16 |
PHPFUSION | Do not use | 64 | Y | | | | Y PHPFUSION | Do not use | 64 | Y | | | | Y
@ -82,4 +82,4 @@ or bad.
--- ---
This page was automatically generated on the [AuthMe-Team/AuthMeReloaded repository](https://github.com/AuthMe-Team/AuthMeReloaded/tree/master/docs/) on Wed Jun 22 17:39:16 EDT 2016 This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sat Oct 01 23:42:20 CEST 2016

View File

@ -1,11 +1,12 @@
<!-- AUTO-GENERATED FILE! Do not edit this directly --> <!-- AUTO-GENERATED FILE! Do not edit this directly -->
<!-- File auto-generated on Wed Jun 22 17:39:29 EDT 2016. See permissions/permission_nodes.tpl.md --> <!-- File auto-generated on Sat Oct 01 23:34:27 CEST 2016. See permissions/permission_nodes.tpl.md -->
## AuthMe Permission Nodes ## AuthMe Permission Nodes
The following are the permission nodes that are currently supported by the latest dev builds. The following are the permission nodes that are currently supported by the latest dev builds.
- **authme.admin.*** Give access to all admin commands. - **authme.admin.*** Give access to all admin commands.
- **authme.admin.accounts** Administrator command to see all accounts associated with a user. - **authme.admin.accounts** Administrator command to see all accounts associated with a user.
- **authme.admin.antibotmessages** Administrator command to reload the plugin configuration.
- **authme.admin.changemail** Administrator command to set or change the email address of a user. - **authme.admin.changemail** Administrator command to set or change the email address of a user.
- **authme.admin.changepassword** Administrator command to change the password of a user. - **authme.admin.changepassword** Administrator command to change the password of a user.
- **authme.admin.converter** Administrator command to convert old or other data to AuthMe data. - **authme.admin.converter** Administrator command to convert old or other data to AuthMe data.
@ -46,4 +47,4 @@ The following are the permission nodes that are currently supported by the lates
--- ---
This page was automatically generated on the [AuthMe-Team/AuthMeReloaded repository](https://github.com/AuthMe-Team/AuthMeReloaded/tree/master/docs/) on Wed Jun 22 17:39:29 EDT 2016 This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sat Oct 01 23:34:27 CEST 2016

View File

@ -2,6 +2,7 @@ package fr.xephi.authme;
import fr.xephi.authme.output.MessageKey; import fr.xephi.authme.output.MessageKey;
import fr.xephi.authme.output.Messages; import fr.xephi.authme.output.Messages;
import fr.xephi.authme.permission.AdminPermission;
import fr.xephi.authme.permission.PermissionsManager; import fr.xephi.authme.permission.PermissionsManager;
import fr.xephi.authme.permission.PlayerStatePermission; import fr.xephi.authme.permission.PlayerStatePermission;
import fr.xephi.authme.settings.Settings; import fr.xephi.authme.settings.Settings;
@ -15,6 +16,7 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner; import org.mockito.runners.MockitoJUnitRunner;
import java.util.Arrays;
import java.util.List; import java.util.List;
import static fr.xephi.authme.util.BukkitService.TICKS_PER_MINUTE; import static fr.xephi.authme.util.BukkitService.TICKS_PER_MINUTE;
@ -115,20 +117,25 @@ public class AntiBotTest {
@Test @Test
public void shouldActivateAntiBot() { public void shouldActivateAntiBot() {
// given // given
given(messages.retrieve(MessageKey.ANTIBOT_AUTO_ENABLED_MESSAGE))
.willReturn(new String[]{"Test line #1", "Test line #2"});
int duration = 300; int duration = 300;
given(settings.getProperty(ProtectionSettings.ANTIBOT_DURATION)).willReturn(duration); given(settings.getProperty(ProtectionSettings.ANTIBOT_DURATION)).willReturn(duration);
AntiBot antiBot = createListeningAntiBot(); AntiBot antiBot = createListeningAntiBot();
List<Player> onlinePlayers = Arrays.asList(mock(Player.class), mock(Player.class), mock(Player.class));
given(bukkitService.getOnlinePlayers()).willReturn((List) onlinePlayers);
given(permissionsManager.hasPermission(onlinePlayers.get(0), AdminPermission.ANTIBOT_MESSAGES)).willReturn(true);
given(permissionsManager.hasPermission(onlinePlayers.get(1), AdminPermission.ANTIBOT_MESSAGES)).willReturn(false);
given(permissionsManager.hasPermission(onlinePlayers.get(2), AdminPermission.ANTIBOT_MESSAGES)).willReturn(true);
// when // when
antiBot.activateAntiBot(); antiBot.activateAntiBot();
// then // then
assertThat(antiBot.getAntiBotStatus(), equalTo(AntiBot.AntiBotStatus.ACTIVE)); assertThat(antiBot.getAntiBotStatus(), equalTo(AntiBot.AntiBotStatus.ACTIVE));
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class); verify(bukkitService).getOnlinePlayers();
verify(messages, times(2)).send(captor.capture()); verify(permissionsManager, times(3)).hasPermission(any(Player.class), eq(AdminPermission.ANTIBOT_MESSAGES));
assertThat(captor.getAllValues(), contains("Test line #1", "Test line #2")); verify(messages).send(onlinePlayers.get(0), MessageKey.ANTIBOT_AUTO_ENABLED_MESSAGE);
verify(messages, never()).send(onlinePlayers.get(1), MessageKey.ANTIBOT_AUTO_ENABLED_MESSAGE);
verify(messages).send(onlinePlayers.get(2), MessageKey.ANTIBOT_AUTO_ENABLED_MESSAGE);
long expectedTicks = duration * TICKS_PER_MINUTE; long expectedTicks = duration * TICKS_PER_MINUTE;
verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(expectedTicks)); verify(bukkitService).scheduleSyncDelayedTask(any(Runnable.class), eq(expectedTicks));
} }

View File

@ -152,7 +152,7 @@ public class EncryptionMethodInfoGatherer {
// By passing some bogus "package" to the constructor, the injector will throw if it needs to // By passing some bogus "package" to the constructor, the injector will throw if it needs to
// instantiate any dependency other than what we provide. // instantiate any dependency other than what we provide.
Injector injector = new InjectorBuilder().addDefaultHandlers("!!No package!!").create(); Injector injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authme.security.crypts").create();
injector.register(Settings.class, settings); injector.register(Settings.class, settings);
return injector; return injector;
} }