| AnyConnect Secure Mobility Client 5.1.10.233

PromptEntry.h
1/**************************************************************************
2* Copyright (c) 2006, 2022 Cisco Systems, Inc.
3* All Rights Reserved. Cisco Highly Confidential.
4***************************************************************************
5*
6* File: PromptEntry.h
7* Date: 08/2006
8*
9***************************************************************************
10* Prompt Entry class implementation for the Client API.
11***************************************************************************/
12
13#ifndef _PROMPTENTRY_
14#define _PROMPTENTRY_
15
16
17#include "PromptEntryBase.h"
18
19/**
20 * When Authentication requires a user to enter credentials or view a banner in
21 * conjunction with their VPN activation, one or more PromptEntry objects are
22 * created. Each PromptEntry typically contains a label and value. The
23 * value can be set with a default value that the user can then change.
24 *
25 * PromptEntry instances are collected into a list and delivered in a single
26 * instance of the ConnectPromptInfo class.
27 *
28 * When the selections or values are complete (using setValue method) for all
29 * the PromptEntry instances, simply call the API method
30 * ClientIfc::UserSubmit to alert the API that it can
31 * process the responses and proceed with VPN establishment.
32 *
33 * An example of accessing individual PromptEntry and their values can be
34 * found in ClientImpl::setUserData
35 *
36 */
37
38
39 class VPN_VPNAPI PromptEntry : public PromptEntryBase
40{
41 public:
42
43 /**
44 * use this method to get the current value set in the prompt entry.
45 */
46 const tstring& getValue() const;
47
48 /**
49 * use this method to set the user selection. If a default value is
50 * present, it's value will be used unless this method in invoked.
51 * Returns true if the value is successfully set.
52 */
53 bool setValue(const tstring& value);
54
55
56 /**
57 * The fixed name associated with this prompt entry.
58 * This represents a non-translated fixed entity, whereas the
59 * label is a translated entry.
60 */
61 const tstring &getPromptName() const;
62
63
64 /**
65 * Set/get the label associated with this prompt entry.
66 * This value is translated if a translation is available.
67 */
68 const tstring &getPromptLabel() const;
69
70
71 /**
72 * Return the type of prompt entry. See the enum PromptType for
73 * the possible types.
74 */
75 PromptType getPromptType() const;
76
77 /**
78 * Get the enabled state of this prompt entry which indicates if
79 * it can be edited.
80 */
81 bool isEnabled() const;
82
83
84 /**
85 * Get the visible state of this prompt entry which indicates if
86 * it should be displayed.
87 */
88 bool isVisible() const;
89
90
91 /**
92 * If a prompt entry has a list of possible selection, (like Prompt_Combo
93 * and Prompt_Checkbox in ::PromptType enum in api.h), that list is
94 * available via this method. For example, a checkbox type prompt
95 * would return "true" and "false" as options. The values returned could for
96 * example, be displayed in a combo box selection.
97 */
98 const std::list<tstring> &getValueOptions() const;
99
100
101 /**
102 * Use this prompt entry for group values
103 */
104 bool isEntryGroup() const;
105
106 /*
107 * Returns whether this prompt entry is read only (IE
108 * it does not require user input)
109 */
110 bool isReadOnly() const;
111
112
113 static tstring Username; /**< Identifies the PromptEntry instance
114 requesting a username.
115 See getPromptName() method and example
116 in ClientImpl::setUserData() */
117 static tstring Password; /**< Identifies PromptEntry instance
118 requesting a password.
119 See getPromptName() method and example
120 in ClientImpl::setUserData() */
121 static tstring SecondaryUsername; /**< Identifies PromptEntry instance
122 requesting secondary username. */
123 static tstring SecondaryPassword; /**< Identifies PromptEntry instance
124 requesting secondary password. */
125 static tstring GroupList; /**< Identifies PromptEntry instance
126 with group list. */
127 static tstring Banner; /**< Identifies PromptEntry instance
128 containing banner. */
129 static tstring Pin; /**< Identifies PromptEntry PIN */
130 static tstring VerifyPin; /**< Identifies PromptEntry Verify PIN */
131 static tstring NetAccess; /**< Identifies the PromptEntry displaying
132 the network access state. */
133
134 // The following methods are used to configure the PromptEntry
135 // and do not need to be used by a client application.
136
137
138 PromptEntry(tstring PromptName,
139 tstring PromptLabel,
140 PromptType promptType = Prompt_Input,
141 const tstring& DefaultValue = EmptyString,
142 ApiStringMap LabelValues = EmptyLabelValues);
143
144 virtual ~PromptEntry() {};
145
146 /**
147 * Deep Copy Constructor
148 */
149 explicit PromptEntry(
150 const PromptEntry& existingEntry)
151 :
152 PromptEntryBase(existingEntry)
153 {
154 }
155
156 /**
157 * Deep Copy Assignment Operator
158 */
159 PromptEntry& operator=(const PromptEntry& existingEntry)
160 {
161 if (std::addressof(existingEntry) != this)
162 {
163 PromptEntryBase::operator=(existingEntry);
164 }
165 return *this;
166 }
167
168};
169
170
171#endif // _PROMPTENTRY_
PromptType
PromptType
Definition api.h:258
Prompt_Input
@ Prompt_Input
Definition api.h:258
tstring
#define tstring
Definition api.h:35
PromptEntry::getPromptName
const tstring & getPromptName() const
PromptEntry::getValueOptions
const std::list< tstring > & getValueOptions() const
PromptEntry::isEnabled
bool isEnabled() const
PromptEntry::Username
static tstring Username
Definition PromptEntry.h:113
PromptEntry::Password
static tstring Password
Definition PromptEntry.h:117
PromptEntry::NetAccess
static tstring NetAccess
Definition PromptEntry.h:131
PromptEntry::SecondaryPassword
static tstring SecondaryPassword
Definition PromptEntry.h:123
PromptEntry::SecondaryUsername
static tstring SecondaryUsername
Definition PromptEntry.h:121
PromptEntry::getPromptLabel
const tstring & getPromptLabel() const
PromptEntry::Banner
static tstring Banner
Definition PromptEntry.h:127
PromptEntry::GroupList
static tstring GroupList
Definition PromptEntry.h:125
PromptEntry::getValue
const tstring & getValue() const
PromptEntry::Pin
static tstring Pin
Definition PromptEntry.h:129
PromptEntry::getPromptType
PromptType getPromptType() const
PromptEntry::operator=
PromptEntry & operator=(const PromptEntry &existingEntry)
Definition PromptEntry.h:159
PromptEntry::isVisible
bool isVisible() const
PromptEntry::setValue
bool setValue(const tstring &value)
PromptEntry::isEntryGroup
bool isEntryGroup() const
PromptEntry::VerifyPin
static tstring VerifyPin
Definition PromptEntry.h:130
PromptEntry::PromptEntry
PromptEntry(const PromptEntry &existingEntry)
Definition PromptEntry.h:149