Skip to content

Commit c739789

Browse files
committed
delete duplicate module.
1 parent dce73a5 commit c739789

File tree

4 files changed

+20
-55
lines changed

4 files changed

+20
-55
lines changed
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2022, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,9 +18,6 @@
1818
import javax.crypto.SecretKey;
1919
import javax.crypto.SecretKeyFactory;
2020
import javax.crypto.spec.PBEKeySpec;
21-
import javax.crypto.spec.SecretKeySpec;
22-
import java.nio.charset.StandardCharsets;
23-
import java.security.InvalidKeyException;
2421
import java.security.NoSuchAlgorithmException;
2522
import java.security.spec.InvalidKeySpecException;
2623
import java.security.spec.KeySpec;
@@ -29,7 +26,7 @@
2926
import io.fusionauth.plugin.spi.security.PasswordEncryptor;
3027

3128
/**
32-
* This is an example of a PBKDF2 HMAC SHA256 Salted hashing algorithm with a key length of 512. This is the default hashing algorithm for Keycloak.
29+
* This is an example of a PBKDF2 HMAC SHA256 Salted hashing algorithm with a key length of 512. This is the default hashing algorithm for Keycloak.
3330
*
3431
* <p>
3532
* This code is provided to assist in your deployment and management of FusionAuth. Use of this
@@ -39,8 +36,7 @@
3936
*
4037
* @author Dan Moore
4138
*/
42-
public class ExamplePBDKF2HMACSHA256Keylength512PasswordHasher implements PasswordEncryptor {
43-
39+
public class ExamplePBDKF2HMACSHA256KeyLength512PasswordHasher implements PasswordEncryptor {
4440
@Override
4541
public int defaultFactor() {
4642
return 10_000;
@@ -70,4 +66,9 @@ public String encrypt(String password, String salt, int factor) {
7066
byte[] encoded = secret.getEncoded();
7167
return new String(Base64.getEncoder().encode(encoded));
7268
}
69+
70+
// @Override
71+
// public String pluginDisplayName() {
72+
// return "Super Awesome KeyCloak PBKDF2 512 Algorithm";
73+
// }
7374
}

src/main/java/com/mycompany/fusionauth/plugins/guice/MyExampleFusionAuthPBKDF2PluginModule.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/main/java/com/mycompany/fusionauth/plugins/guice/MyExampleFusionAuthPluginModule.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2020-2022, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,10 +17,9 @@
1717

1818
import com.google.inject.AbstractModule;
1919
import com.google.inject.multibindings.MapBinder;
20-
import com.mycompany.fusionauth.plugins.ExampleArgon2idPasswordEncryptor;
2120
import com.mycompany.fusionauth.plugins.ExampleCustomMD5SaltedPasswordEncryptor;
2221
import com.mycompany.fusionauth.plugins.ExamplePBDKF2HMACSHA1PasswordEncryptor;
23-
import com.mycompany.fusionauth.plugins.ExamplePBDKF2HMACSHA256Keylength512PasswordHasher;
22+
import com.mycompany.fusionauth.plugins.ExamplePBDKF2HMACSHA256KeyLength512PasswordHasher;
2423
import com.mycompany.fusionauth.plugins.ExamplePHPMD5SaltedPasswordEncryptor;
2524
import com.mycompany.fusionauth.plugins.ExampleRfc2898DeriveBytesPasswordEncryptor;
2625
import com.mycompany.fusionauth.plugins.ExampleSaltedSHA512PasswordEncryptor;
@@ -45,7 +44,9 @@ protected void configure() {
4544
// Start with this example and implement it.
4645
passwordEncryptorMapBinder.addBinding("example-hash").to(MyExamplePasswordEncryptor.class);
4746

48-
// Functional examples
47+
//
48+
// Below are Functional examples
49+
//
4950
passwordEncryptorMapBinder.addBinding("example-custom-md5").to(ExampleCustomMD5SaltedPasswordEncryptor.class);
5051
passwordEncryptorMapBinder.addBinding("example-salted-sha512").to(ExampleSaltedSHA512PasswordEncryptor.class);
5152

@@ -61,9 +62,12 @@ protected void configure() {
6162

6263
// Argon2id
6364
// https://github.com/P-H-C/phc-winner-argon2
64-
passwordEncryptorMapBinder.addBinding("example-argon2id").to(ExampleArgon2idPasswordEncryptor.class);
65+
// passwordEncryptorMapBinder.addBinding("example-argon2id").to(ExampleArgon2idPasswordEncryptor.class);
6566

6667
// PBDKF2HMACSHA256 with Keylength 512, useful for keycloak
67-
passwordEncryptorMapBinder.addBinding("example-keycloak").to(ExamplePBDKF2HMACSHA256Keylength512PasswordHasher.class);
68+
passwordEncryptorMapBinder.addBinding("example-keycloak").to(ExamplePBDKF2HMACSHA256KeyLength512PasswordHasher.class);
69+
70+
// Example PBKDF2 with a SHA-1
71+
passwordEncryptorMapBinder.addBinding("example-salted-pbkdf2-hmac-sha1-10000").to(ExamplePBDKF2HMACSHA1PasswordEncryptor.class);
6872
}
6973
}

src/test/java/com/mycompany/fusionauth/plugins/ExamplePBDKF2HMACSHA256Keylength512PasswordHasherTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, FusionAuth, All Rights Reserved
2+
* Copyright (c) 2019-2022, FusionAuth, All Rights Reserved
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
public class ExamplePBDKF2HMACSHA256Keylength512PasswordHasherTest {
2626
@Test(dataProvider = "hashes")
2727
public void encrypt(String password, String salt, String hash) {
28-
ExamplePBDKF2HMACSHA256Keylength512PasswordHasher encryptor = new ExamplePBDKF2HMACSHA256Keylength512PasswordHasher();
28+
ExamplePBDKF2HMACSHA256KeyLength512PasswordHasher encryptor = new ExamplePBDKF2HMACSHA256KeyLength512PasswordHasher();
2929
assertEquals(encryptor.encrypt(password, salt, 27500), hash);
3030
}
3131

0 commit comments

Comments
 (0)