build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / ucbhelper / simpleauthenticationrequest.hxx
blobf1dad91163ae1b83db99656060559a847f364591
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
21 #define INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX
23 #include <rtl/ref.hxx>
24 #include <ucbhelper/interactionrequest.hxx>
25 #include <ucbhelper/ucbhelperdllapi.h>
27 namespace com { namespace sun { namespace star { namespace ucb {
28 class URLAuthenticationRequest;
29 } } } }
31 namespace ucbhelper {
33 /**
34 * This class implements a simple authentication interaction request.
35 * Instances can be passed directly to XInteractionHandler::handle(...). Each
36 * instance contains an AuthenticationRequest and three interaction
37 * continuations: "Abort", "Retry" and "SupplyAuthentication". The parameters
38 * for the AuthenticationRequest and the InteractionSupplyAuthentication
39 * objects are partly taken from contructors parameters and partly defaulted
40 * as follows:
42 * Read-only values : servername, realm
43 * Read-write values: username, password, account
44 * All remember-authentication values: RememberAuthentication_NO
46 * @see css::ucb::AuthenticationRequest
47 * @see css::ucb::RememberAuthentication
48 * @see InteractionAbort
49 * @see InteractionRetry
50 * @see InteractionSupplyAuthentication
52 class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest : public ucbhelper::InteractionRequest
54 rtl::Reference<
55 ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
57 private:
58 void initialize( const css::ucb::URLAuthenticationRequest & rRequest,
59 bool bCanSetRealm,
60 bool bCanSetUserName,
61 bool bCanSetPassword,
62 bool bCanSetAccount,
63 bool bAllowUseSystemCredentials,
64 bool bAllowSessionStoring );
66 public:
67 /** Specification whether some entity (realm, username, password, account)
68 is either not applicable at all, has a fixed value, or is modifiable.
70 enum EntityType
72 ENTITY_NA,
73 ENTITY_FIXED,
74 ENTITY_MODIFY
77 /**
78 * Constructor.
80 * @param rURL contains a URL for which authentication is requested.
81 * @param rServerName contains a server name.
82 * @param rRealm contains a realm, if applicable.
83 * @param rUserName contains a username, if available (for instance from
84 * a previous try).
85 * @param rPassword contains a password, if available (for instance from
86 * a previous try).
87 * @param rAccount contains an account, if applicable.
88 * @param bAllowUseSystemCredentials specifies if requesting client is
89 * able to obtain and use system credentials for authentication
91 SimpleAuthenticationRequest( const OUString & rURL,
92 const OUString & rServerName,
93 const OUString & rRealm,
94 const OUString & rUserName,
95 const OUString & rPassword,
96 const OUString & rAccount,
97 bool bAllowUseSystemCredentials,
98 bool bAllowSessionStoring = true );
102 * Constructor.
104 * @param rServerName contains a server name.
105 * @param eRealmType specifies whether a realm is applicable and
106 modifiable.
107 * @param rRealm contains a realm, if applicable.
108 * @param eUserNameType specifies whether a username is applicable and
109 modifiable.
110 * @param rUserName contains a username, if available (for instance from
111 * a previous try).
112 * @param ePasswordType specifies whether a password is applicable and
113 modifiable.
114 * @param rPassword contains a password, if available (for instance from
115 * a previous try).
117 SimpleAuthenticationRequest( const OUString & rURL,
118 const OUString & rServerName,
119 EntityType eRealmType,
120 const OUString & rRealm,
121 EntityType eUserNameType,
122 const OUString & rUserName,
123 EntityType ePasswordType,
124 const OUString & rPassword );
127 * This method returns the supplier for the missing authentication data,
128 * that, for instance can be used to query the password supplied by the
129 * interaction handler.
131 * @return the supplier for the missing authentication data.
133 const rtl::Reference< ucbhelper::InteractionSupplyAuthentication > &
134 getAuthenticationSupplier() const { return m_xAuthSupplier; }
137 } // namespace ucbhelper
139 #endif /* ! INCLUDED_UCBHELPER_SIMPLEAUTHENTICATIONREQUEST_HXX */
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */