Remove credentials class

This commit is contained in:
Dominic Grimm 2024-02-18 19:13:17 +01:00
parent ccdb0d1799
commit f1e788fcd4
2 changed files with 3 additions and 26 deletions

View file

@ -1,22 +0,0 @@
/*
* Copyright 2024 Dominic Grimm
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dergrimm.keycloak.providers.events.mqtt
private final case class Credentials(
username: String,
password: String
)

View file

@ -81,8 +81,7 @@ class MqttEventListenerProviderFactory(
val credentials =
val username = config.get("username")
val password = config.get("password")
if username != null && password != null then
Some(Credentials(username, password))
if username != null && password != null then Some((username, password))
else None
val cleanSession = config.getBoolean("cleanSession", true)
@ -100,8 +99,8 @@ class MqttEventListenerProviderFactory(
credentials match
case Some(creds) =>
connectionSettings = connectionSettings.withAuth(
username = creds.username,
password = creds.password
username = creds(0),
password = creds(1)
)
case None => {}