| AnyConnect Secure Mobility Client 5.0.05040

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# include/PromptEntryBase.h

    00001 /**************************************************************************
    00002 *   Copyright (c) 2008, 2022-2023 Cisco Systems, Inc.
    00003 *   All Rights Reserved. Cisco Highly Confidential.
    00004 ***************************************************************************
    00005 *
    00006 *   File:   PromptEntryBase.h
    00007 *   Date:   01/2008
    00008 *
    00009 ***************************************************************************
    00010 *   Prompt Entry base class implementation for the Client API.
    00011 ***************************************************************************/
    00012
    00013 #ifndef _PROMPTENTRYBASE_
    00014 #define _PROMPTENTRYBASE_
    00015
    00016
    00017 #include "api.h"
    00018 #include <list>
    00019
    00020
    00021 #define PROMPT_ENTRY_VALUE_TRUE  _T("true")
    00022 #define PROMPT_ENTRY_VALUE_FALSE  _T("false")
    00023
    00024 class VPN_VPNAPI PromptEntryBase
    00025 {
    00026 public:
    00027
    00028     bool setValue(const tstring& value);
    00029     bool clearValue();
    00030
    00031     const tstring &getPromptName() const;
    00032
    00033     const tstring &getPromptLabel() const;
    00034
    00035     bool isEnabled() const;
    00036
    00037     void setEnabled(bool bIsEnabled);
    00038
    00039     bool isVisible() const;
    00040
    00041     void setVisible(bool bIsVisible);
    00042
    00043     // if this is a PromptEntry that has a list of values
    00044     // (e.g. combo box style) the default will be to mark it as a group
    00045     // combo.  This method allows the group designation to be set directly.
    00046     //
    00047     void setEntryGroup(bool bIsEntryGroup);
    00048
    00049
    00050     PromptEntryBase(tstring PromptName,
    00051                     tstring PromptLabel,
    00052                     PromptType promptType = Prompt_Input,
    00053                     const tstring& DefaultValue = EmptyString,
    00054                     ApiStringMap LabelValues = EmptyLabelValues);
    00055
    00056
    00057     void setPromptLabel(tstring label);
    00058
    00059     // In cases of prompt types with options (checkbox, combobox),
    00060     // this will return the translated label (of the option).
    00061     const tstring &getValue() const;
    00062
    00063     // this function returns the internal representation of the value
    00064     const tstring &getTrueValue() const;
    00065
    00066     const std::list<tstring> &getValueOptions() const;
    00067
    00068     bool isEntryGroup() const;
    00069
    00070     bool isReadOnly() const;
    00071
    00072     PromptType getPromptType() const;
    00073
    00074     size_t GetGroupAttributesCount();
    00075
    00076
    00077     virtual ~PromptEntryBase();
    00078
    00079     static const tstring EmptyString;
    00080
    00081     static const std::list<tstring> EmptyList;
    00082
    00083     static const ApiStringMap EmptyLabelValues;
    00084
    00085     // Deep Copy Assignment Operator
    00086     //
    00087     PromptEntryBase& operator=(const PromptEntryBase& existingEntry)
    00088     {
    00089         return deepCopy(existingEntry);
    00090     }
    00091
    00092     // Deep Copy Constructor
    00093     //
    00094     explicit PromptEntryBase(const PromptEntryBase& existingEntry)
    00095     {
    00096         deepCopy(existingEntry);
    00097     }
    00098
    00099
    00100 private:
    00101
    00102     PromptEntryBase& deepCopy(const PromptEntryBase& existingEntry);
    00103
    00104     tstring ms_PromptName;
    00105     tstring ms_PromptLabel;
    00106     PromptType me_PromptType;
    00107     tstring ms_Value;
    00108     ApiStringMap msm_LabelValueMap;
    00109     std::list<tstring> mls_ValueOptions;
    00110     bool mb_IsEntryGroup;
    00111     bool mb_Enabled;
    00112     bool mb_Visible;
    00113
    00114 public:
    00115
    00116     class GroupAttributes
    00117     {
    00118     public:
    00119         GroupAttributes() :
    00120             CredRequired(true),
    00121             UsesSDIAuth(false),
    00122             UsernameEditable(true),
    00123             SecondaryUsernameEditable(true),
    00124             UsesSecondaryAuth(false)
    00125         {
    00126         }
    00127
    00128         // Deep Copy Constructor
    00129         //
    00130         explicit GroupAttributes(
    00131             const GroupAttributes& existingGroupAttr)
    00132         {
    00133             deepCopy(existingGroupAttr);
    00134         }
    00135
    00136         // Deep Copy Assignment Operator
    00137         //
    00138         GroupAttributes& operator=(
    00139             const GroupAttributes& existingGroupAttr)
    00140         {
    00141             return deepCopy(existingGroupAttr);
    00142         }
    00143
    00144         bool CredRequired;
    00145         bool UsesSDIAuth;
    00146         bool UsernameEditable;
    00147         tstring Username;
    00148         bool SecondaryUsernameEditable;
    00149         tstring SecondaryUsername;
    00150         bool UsesSecondaryAuth;
    00151
    00152     private:
    00153         GroupAttributes& deepCopy(const GroupAttributes& existingGroupAttr)
    00154         {
    00155             if (std::addressof(existingGroupAttr) != this)
    00156             {
    00157                 CredRequired = existingGroupAttr.CredRequired;
    00158                 UsesSDIAuth = existingGroupAttr.UsesSDIAuth;
    00159                 UsernameEditable = existingGroupAttr.UsernameEditable;
    00160                 Username = existingGroupAttr.Username.c_str();
    00161                 SecondaryUsernameEditable = existingGroupAttr.SecondaryUsernameEditable;
    00162                 SecondaryUsername = existingGroupAttr.SecondaryUsername.c_str();
    00163                 UsesSecondaryAuth = existingGroupAttr.UsesSecondaryAuth;
    00164             }
    00165             return *this;
    00166         }
    00167     };
    00168
    00169     class SingleAttributes
    00170     {
    00171     public:
    00172         SingleAttributes() :
    00173             SecondaryAuthEntry(false),
    00174             SSOTimeoutSeconds(0),
    00175             SSOIsExternalBrowser(false)
    00176         {
    00177         }
    00178
    00179         // Deep Copy Constructor
    00180         //
    00181         explicit SingleAttributes(
    00182             const SingleAttributes& existingSingleAttr)
    00183         {
    00184             deepCopy(existingSingleAttr);
    00185         }
    00186
    00187         // Deep Copy Assignment Operator
    00188         //
    00189         SingleAttributes& operator=(
    00190             const SingleAttributes& existingSingleAttr)
    00191         {
    00192             return deepCopy(existingSingleAttr);
    00193         }
    00194
    00195         bool SecondaryAuthEntry;
    00196         tstring SSOURL;
    00197         tstring SSOFinalURL;
    00198         tstring SSOTokenCookieName;
    00199         tstring SSOErrorCookieName;
    00200         unsigned int SSOTimeoutSeconds;
    00201         tstring SSOUserAgent;
    00202         bool SSOIsExternalBrowser;
    00203
    00204     private:
    00205         SingleAttributes& deepCopy(const SingleAttributes& existingSingleAttr)
    00206         {
    00207             if (std::addressof(existingSingleAttr) != this)
    00208             {
    00209                 SecondaryAuthEntry = existingSingleAttr.SecondaryAuthEntry;
    00210                 SSOURL = existingSingleAttr.SSOURL.c_str();
    00211                 SSOFinalURL = existingSingleAttr.SSOFinalURL.c_str();
    00212                 SSOTokenCookieName = existingSingleAttr.SSOTokenCookieName.c_str();
    00213                 SSOErrorCookieName = existingSingleAttr.SSOErrorCookieName.c_str();
    00214                 SSOTimeoutSeconds = existingSingleAttr.SSOTimeoutSeconds;
    00215                 SSOUserAgent = existingSingleAttr.SSOUserAgent.c_str();
    00216                 SSOIsExternalBrowser = existingSingleAttr.SSOIsExternalBrowser;
    00217             }
    00218             return *this;
    00219         }
    00220     };
    00221
    00222     typedef std::map<tstring, GroupAttributes> GroupAttributesMap;
    00223
    00224     const GroupAttributes& getGroupAttributes(const tstring& group) const;
    00225     void setGroupAttributesMap(const GroupAttributesMap& groupAttributesMap);
    00226
    00227     const SingleAttributes& getSingleAttributes() const;
    00228     void setSingleAttributes(const SingleAttributes& singleAttributes);
    00229
    00230 private:
    00231
    00232     void copyGroupAttributesMap (const GroupAttributesMap &srcMap,
    00233                                  GroupAttributesMap &dstMap);
    00234
    00235     static const GroupAttributes DefaultGroupAttributes;
    00236     GroupAttributesMap m_GroupAttributesMap;
    00237     SingleAttributes m_SingleAttributes;
    00238 };
    00239
    00240
    00241 #endif // _PROMPTENTRYBASE_