internal class PairingApplicationServiceTest @Autowired constructor(
private val pas: PairingApplicationService,
private val mpas: MonitorPowerUpApplicationService
) {
private lateinit var client: IMqttClient
@BeforeEach
fun setup() {
client = MqttClient( "tcp://localhost:1883", MqttClient.generateClientId(), MemoryPersistence())
}
@Test
fun activate() {
val sn = UUID.randomUUID().toString()
val pass = "pass"
val conOpt = MqttConnectOptions()
conOpt.userName = sn
conOpt.password = pass.toCharArray()
assertThrows<MqttSecurityException> {
client.connect(conOpt)
}
val registration = MonitorPowerUpApplicationService.Registration(sn, "2", pass)
mpas.register(registration)
pas.activate(sn)
client.connect(conOpt)
}
--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/20558206-5f4f-f784-1cc0-a315db619965%40thepeng.eu.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/20558206-5f4f-f784-1cc0-a315db619965%40thepeng.eu.
import org.springframework.security.crypto.codec.Utf8
import org.springframework.security.crypto.keygen.KeyGenerators
import org.springframework.security.crypto.password.PasswordEncoder
import org.springframework.security.crypto.util.EncodingUtils.concatenate
import java.security.MessageDigest
import java.util.Base64
class RabbitMqPasswordEncoder(
algorithm: String = "SHA-256"
) : PasswordEncoder {
private val digester = MessageDigest.getInstance(algorithm)
private val saltGenerator = KeyGenerators.secureRandom(4)
override fun encode(rawPassword: CharSequence): String {
return encode(rawPassword, saltGenerator.generateKey())
}
override fun matches(rawPassword: CharSequence, encodedPassword: String): Boolean {
throw UnsupportedOperationException("don't use this class for authentication")
}
fun encode(rawPassword: CharSequence, salt: ByteArray): String {
val digest = digest(rawPassword, salt)
return Base64.getEncoder().encodeToString(digest)
}
private fun digest(rawPassword: CharSequence, salt: ByteArray): ByteArray {
val digest = digester.digest(
concatenate(
salt,
Utf8.encode(rawPassword)
)
)
return concatenate(salt, digest)
}
}
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/20558206-5f4f-f784-1cc0-a315db619965%40thepeng.eu.
--
--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/d722007b-e83c-4b3e-996f-0ca1c35ac8ab%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/7dee6f6c-1551-4f0b-9db9-5b8fc6ea5d29%40googlegroups.com.
yes, I've read that, I even implemented a test that ensure's my implementation is correct... now I know why this isn't making sense.in my log output above you can see that I transmitted `passwordHash` not `password_hash`, this seems to be a feature wanting... to throw a 400 on missing key, instead of it getting a 201 Created. Trying to figure out how this happened to begin with... something to do with jackson on my end, but not sure what.
On Mon, Sep 16, 2019 at 11:39 AM Luke Bakken <lba...@pivotal.io> wrote:
Hi Caleb,--If authenticate_user fails it probably means the hashing method you're using is incorrect. To verify this, use the HTTP API to create your user but send a plain text password instead of a hashed one.I'm sure you've already read this but just in case you haven't ... https://www.rabbitmq.com/passwords.html#computing-password-hashThanks,Luke
On Monday, September 16, 2019 at 9:36:35 AM UTC-7, Caleb Cushing wrote:yes I was just trying that, and it also fails with invalid credentials, which is making little sense to me. Only thing I can think of is something is wrong with my password encoder implementation. If that is true, then why was it failing with an authorization failure earlier, or can that fail prior to authentication in rabbitmq?
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/7dee6f6c-1551-4f0b-9db9-5b8fc6ea5d29%40googlegroups.com.
The tags key is mandatory. Either password or password_hash must be set. Setting password_hash to "" will ensure the user cannot use a password to log in. tags is a comma-separated list of tags for the user. Currently recognised tags are administrator, monitoring and management. password_hash must be generated using the algorithm described here. You may also specify the hash function being used by adding the hashing_algorithm key to the body. Currently recognised algorithms are rabbit_password_hashing_sha256, rabbit_password_hashing_sha512, and rabbit_password_hashing_md5. |
Hi Caleb,Well, considering you can create a password-less user, neither password nor password_hash are required. I'll bring up validation with the team.Thanks for following up -
Luke
On Monday, September 16, 2019 at 11:05:00 AM UTC-7, Caleb Cushing wrote:
yes, I've read that, I even implemented a test that ensure's my implementation is correct... now I know why this isn't making sense.in my log output above you can see that I transmitted `passwordHash` not `password_hash`, this seems to be a feature wanting... to throw a 400 on missing key, instead of it getting a 201 Created. Trying to figure out how this happened to begin with... something to do with jackson on my end, but not sure what.
On Mon, Sep 16, 2019 at 11:39 AM Luke Bakken <lba...@pivotal.io> wrote:
Hi Caleb,--If authenticate_user fails it probably means the hashing method you're using is incorrect. To verify this, use the HTTP API to create your user but send a plain text password instead of a hashed one.I'm sure you've already read this but just in case you haven't ... https://www.rabbitmq.com/passwords.html#computing-password-hashThanks,Luke
On Monday, September 16, 2019 at 9:36:35 AM UTC-7, Caleb Cushing wrote:yes I was just trying that, and it also fails with invalid credentials, which is making little sense to me. Only thing I can think of is something is wrong with my password encoder implementation. If that is true, then why was it failing with an authorization failure earlier, or can that fail prior to authentication in rabbitmq?
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/7dee6f6c-1551-4f0b-9db9-5b8fc6ea5d29%40googlegroups.com.
--
--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/862c50f7-cf4f-4f0b-a5a4-a647deae3be9%40googlegroups.com.
that's not what the api documentation says
The tagskey is mandatory. Eitherpasswordorpassword_hashmust be set. Settingpassword_hashto""will ensure the user cannot use a password to log in.tagsis a comma-separated list of tags for the user. Currently recognised tags areadministrator,monitoringandmanagement.password_hashmust be generated using the algorithm described here. You may also specify the hash function being used by adding thehashing_algorithmkey to the body. Currently recognised algorithms arerabbit_password_hashing_sha256,rabbit_password_hashing_sha512, andrabbit_password_hashing_md5.
On Mon, Sep 16, 2019 at 3:21 PM Luke Bakken <lba...@pivotal.io> wrote:
Hi Caleb,Well, considering you can create a password-less user, neither password nor password_hash are required. I'll bring up validation with the team.Thanks for following up -
Luke
On Monday, September 16, 2019 at 11:05:00 AM UTC-7, Caleb Cushing wrote:
yes, I've read that, I even implemented a test that ensure's my implementation is correct... now I know why this isn't making sense.in my log output above you can see that I transmitted `passwordHash` not `password_hash`, this seems to be a feature wanting... to throw a 400 on missing key, instead of it getting a 201 Created. Trying to figure out how this happened to begin with... something to do with jackson on my end, but not sure what.
On Mon, Sep 16, 2019 at 11:39 AM Luke Bakken <lba...@pivotal.io> wrote:
Hi Caleb,--If authenticate_user fails it probably means the hashing method you're using is incorrect. To verify this, use the HTTP API to create your user but send a plain text password instead of a hashed one.I'm sure you've already read this but just in case you haven't ... https://www.rabbitmq.com/passwords.html#computing-password-hashThanks,Luke
On Monday, September 16, 2019 at 9:36:35 AM UTC-7, Caleb Cushing wrote:yes I was just trying that, and it also fails with invalid credentials, which is making little sense to me. Only thing I can think of is something is wrong with my password encoder implementation. If that is true, then why was it failing with an authorization failure earlier, or can that fail prior to authentication in rabbitmq?
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/7dee6f6c-1551-4f0b-9db9-5b8fc6ea5d29%40googlegroups.com.
--
--
You received this message because you are subscribed to a topic in the Google Groups "rabbitmq-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rabbitmq-users/GtnQR0BSn88/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/862c50f7-cf4f-4f0b-a5a4-a647deae3be9%40googlegroups.com.