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.TreeMap;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
21 * The {@link InitiateAuthRequest} can be used to start a Cognito user SRP authentication challenge or to refresh
22 * expired tokens using a refresh token.
24 * When starting user SRP authentication Cognito will respond with a {@link ChallengeResponse}.
25 * When refreshing expired tokens Cognito grants the new tokens in a {@link AuthenticationResultResponse}.
27 * @author Wouter Born - Initial contribution
30 public class InitiateAuthRequest {
32 public String authFlow = "";
34 public String clientId = "";
36 public Map<String, String> authParameters = new TreeMap<>();
38 InitiateAuthRequest(String authFlow, String clientId, Map<String, String> authParameters) {
39 this.authFlow = authFlow;
40 this.clientId = clientId;
41 this.authParameters.putAll(authParameters);
44 public static InitiateAuthRequest userSrpAuth(String clientId, String username, String srpA) {
45 return new InitiateAuthRequest("USER_SRP_AUTH", clientId, Map.of("USERNAME", username, "SRP_A", srpA));
48 public static InitiateAuthRequest refreshTokenAuth(String clientId, String refreshToken) {
49 return new InitiateAuthRequest("REFRESH_TOKEN_AUTH", clientId, Map.of("REFRESH_TOKEN", refreshToken));