1 | /*!
|
2 | * Copyright 2016 Amazon.com,
|
3 | * Inc. or its affiliates. All Rights Reserved.
|
4 | *
|
5 | * Licensed under the Amazon Software License (the "License").
|
6 | * You may not use this file except in compliance with the
|
7 | * License. A copy of the License is located at
|
8 | *
|
9 | * http://aws.amazon.com/asl/
|
10 | *
|
11 | * or in the "license" file accompanying this file. This file is
|
12 | * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
13 | * CONDITIONS OF ANY KIND, express or implied. See the License
|
14 | * for the specific language governing permissions and
|
15 | * limitations under the License.
|
16 | */
|
17 |
|
18 | /** @class */
|
19 | export default class AuthenticationDetails {
|
20 | /**
|
21 | * Constructs a new AuthenticationDetails object
|
22 | * @param {object=} data Creation options.
|
23 | * @param {string} data.Username User being authenticated.
|
24 | * @param {string} data.Password Plain-text password to authenticate with.
|
25 | * @param {(AttributeArg[])?} data.ValidationData Application extra metadata.
|
26 | * @param {(AttributeArg[])?} data.AuthParamaters Authentication paramaters for custom auth.
|
27 | */
|
28 | constructor(data) {
|
29 | const {
|
30 | ValidationData,
|
31 | Username,
|
32 | Password,
|
33 | AuthParameters,
|
34 | ClientMetadata,
|
35 | } = data || {};
|
36 | this.validationData = ValidationData || {};
|
37 | this.authParameters = AuthParameters || {};
|
38 | this.clientMetadata = ClientMetadata || {};
|
39 | this.username = Username;
|
40 | this.password = Password;
|
41 | }
|
42 |
|
43 | /**
|
44 | * @returns {string} the record's username
|
45 | */
|
46 | getUsername() {
|
47 | return this.username;
|
48 | }
|
49 |
|
50 | /**
|
51 | * @returns {string} the record's password
|
52 | */
|
53 | getPassword() {
|
54 | return this.password;
|
55 | }
|
56 |
|
57 | /**
|
58 | * @returns {Array} the record's validationData
|
59 | */
|
60 | getValidationData() {
|
61 | return this.validationData;
|
62 | }
|
63 |
|
64 | /**
|
65 | * @returns {Array} the record's authParameters
|
66 | */
|
67 | getAuthParameters() {
|
68 | return this.authParameters;
|
69 | }
|
70 |
|
71 | /**
|
72 | * @returns {ClientMetadata} the clientMetadata for a Lambda trigger
|
73 | */
|
74 | getClientMetadata() {
|
75 | return this.clientMetadata;
|
76 | }
|
77 | }
|