2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.windcentrale.internal.dto;
16 import java.util.Objects;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
21 * The {@link ChallengeResponse} is the response of Cognito when starting user SRP authentication with a
22 * {@link InitiateAuthRequest}. It is answered using a {@link RespondToAuthChallengeRequest}.
24 * @author Wouter Born - Initial contribution
27 public class ChallengeResponse {
29 public String challengeName = "";
30 public Map<String, String> challengeParameters = Map.of();
32 private String getChallengeParameter(String key) {
33 return Objects.requireNonNullElse(challengeParameters.get(key), "");
36 public String getSalt() {
37 return getChallengeParameter("SALT");
40 public String getSecretBlock() {
41 return getChallengeParameter("SECRET_BLOCK");
44 public String getSrpB() {
45 return getChallengeParameter("SRP_B");
48 public String getUsername() {
49 return getChallengeParameter("USERNAME");
52 public String getUserIdForSrp() {
53 return getChallengeParameter("USER_ID_FOR_SRP");