📄 svn_auth.h
字号:
/** @c SVN_AUTH_CRED_SSL_SERVER_TRUST credentials. */
typedef struct svn_auth_cred_ssl_server_trust_t
{
/** Indicates if the credentials may be saved (to disk). For example, a
* GUI prompt implementation with a checkbox to accept the certificate
* permanently shall set @a may_save to TRUE if the checkbox is checked.
*/
svn_boolean_t may_save;
/** Bit mask of the accepted failures */
apr_uint32_t accepted_failures;
} svn_auth_cred_ssl_server_trust_t;
/** Credential-constructing prompt functions. **/
/** These exist so that different client applications can use
* different prompt mechanisms to supply the same credentials. For
* example, if authentication requires a username and password, a
* command-line client's prompting function might prompt first for the
* username and then for the password, whereas a GUI client's would
* present a single dialog box asking for both, and a telepathic
* client's would read all the information directly from the user's
* mind. All these prompting functions return the same type of
* credential, but the information used to construct the credential is
* gathered in an interface-specific way in each case.
*/
/** Set @a *cred by prompting the user, allocating @a *cred in @a pool.
* @a baton is an implementation-specific closure.
*
* If @a realm is non-null, maybe use it in the prompt string.
*
* If @a username is non-null, then the user might be prompted only
* for a password, but @a *creds would still be filled with both
* username and password. For example, a typical usage would be to
* pass @a username on the first call, but then leave it null for
* subsequent calls, on the theory that if credentials failed, it's
* as likely to be due to incorrect username as incorrect password.
*
* If @a may_save is FALSE, the auth system does not allow the credentials
* to be saved (to disk). A prompt function shall not ask the user if the
* credentials shall be saved if @a may_save is FALSE. For example, a GUI
* client with a remember password checkbox would grey out the checkbox if
* @a may_save is FALSE.
*/
typedef svn_error_t *
(*svn_auth_simple_prompt_func_t) (svn_auth_cred_simple_t **cred,
void *baton,
const char *realm,
const char *username,
svn_boolean_t may_save,
apr_pool_t *pool);
/** Set @a *cred by prompting the user, allocating @a *cred in @a pool.
* @a baton is an implementation-specific closure.
*
* If @a realm is non-null, maybe use it in the prompt string.
*
* If @a may_save is FALSE, the auth system does not allow the credentials
* to be saved (to disk). A prompt function shall not ask the user if the
* credentials shall be saved if @a may_save is FALSE. For example, a GUI
* client with a remember username checkbox would grey out the checkbox if
* @a may_save is FALSE.
*/
typedef svn_error_t *
(*svn_auth_username_prompt_func_t) (svn_auth_cred_username_t **cred,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool);
/** @name SSL server certificate failure bits
*
* @note These values are stored in the on disk auth cache by the SSL
* server certificate auth provider, so the meaning of these bits must
* not be changed.
* @{
*/
/** Certificate is not yet valid. */
#define SVN_AUTH_SSL_NOTYETVALID 0x00000001
/** Certificate has expired. */
#define SVN_AUTH_SSL_EXPIRED 0x00000002
/** Certificate's CN (hostname) does not match the remote hostname. */
#define SVN_AUTH_SSL_CNMISMATCH 0x00000004
/** @brief Certificate authority is unknown (i.e. not trusted) */
#define SVN_AUTH_SSL_UNKNOWNCA 0x00000008
/** @brief Other failure. This can happen if neon has introduced a new
* failure bit that we do not handle yet. */
#define SVN_AUTH_SSL_OTHER 0x40000000
/** @} */
/** Set @a *cred by prompting the user, allocating @a *cred in @a pool.
* @a baton is an implementation-specific closure.
*
* @a cert_info is a structure describing the server cert that was
* presented to the client, and @a failures is a bitmask that
* describes exactly why the cert could not be automatically validated.
* (See the #define error flag values below.) @a realm is a string
* that can be used in the prompt string.
*
* If @a may_save is FALSE, the auth system does not allow the credentials
* to be saved (to disk). A prompt function shall not ask the user if the
* credentials shall be saved if @a may_save is FALSE. For example, a GUI
* client with a trust permanently checkbox would grey out the checkbox if
* @a may_save is FALSE.
*/
typedef svn_error_t *(*svn_auth_ssl_server_trust_prompt_func_t) (
svn_auth_cred_ssl_server_trust_t **cred,
void *baton,
const char *realm,
apr_uint32_t failures,
const svn_auth_ssl_server_cert_info_t *cert_info,
svn_boolean_t may_save,
apr_pool_t *pool);
/** Set @a *cred by prompting the user, allocating @a *cred in @a pool.
* @a baton is an implementation-specific closure. @a realm is a string
* that can be used in the prompt string.
*
* If @a may_save is FALSE, the auth system does not allow the credentials
* to be saved (to disk). A prompt function shall not ask the user if the
* credentials shall be saved if @a may_save is FALSE. For example, a GUI
* client with a remember certificate checkbox would grey out the checkbox
* if @a may_save is FALSE.
*/
typedef svn_error_t *(*svn_auth_ssl_client_cert_prompt_func_t) (
svn_auth_cred_ssl_client_cert_t **cred,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool);
/** Set @a *cred by prompting the user, allocating @a *cred in @a pool.
* @a baton is an implementation-specific closure. @a realm is a string
* identifying the certificate, and can be used in the prompt string.
*
* If @a may_save is FALSE, the auth system does not allow the credentials
* to be saved (to disk). A prompt function shall not ask the user if the
* credentials shall be saved if @a may_save is FALSE. For example, a GUI
* client with a remember password checkbox would grey out the checkbox if
* @a may_save is FALSE.
*/
typedef svn_error_t *(*svn_auth_ssl_client_cert_pw_prompt_func_t) (
svn_auth_cred_ssl_client_cert_pw_t **cred,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool);
/** Initialize an authentication system.
*
* Return an authentication object in @a *auth_baton (allocated in @a
* pool) that represents a particular instance of the svn
* authentication system. @a providers is an array of @c
* svn_auth_provider_object_t pointers, already allocated in @a pool
* and intentionally ordered. These pointers will be stored within @a
* *auth_baton, grouped by credential type, and searched in this exact
* order.
*/
void svn_auth_open(svn_auth_baton_t **auth_baton,
apr_array_header_t *providers,
apr_pool_t *pool);
/** Set an authentication run-time parameter.
*
* Store @a name / @a value pair as a run-time parameter in @a
* auth_baton, making the data accessible to all providers. @a name
* and @a value will be NOT be duplicated into the auth_baton's
* pool. To delete a run-time parameter, pass NULL for @a value.
*/
void svn_auth_set_parameter(svn_auth_baton_t *auth_baton,
const char *name,
const void *value);
/** Get an authentication run-time parameter.
*
* Return a value for run-time parameter @a name from @a auth_baton.
* Return NULL if the parameter doesn't exist.
*/
const void * svn_auth_get_parameter(svn_auth_baton_t *auth_baton,
const char *name);
/** Universal run-time parameters, made available to all providers.
If you are writing a new provider, then to be a "good citizen",
you should notice these global parameters! Note that these
run-time params should be treated as read-only by providers; the
application is responsible for placing them into the auth_baton
hash. */
/** The auth-hash prefix indicating that the parameter is global. */
#define SVN_AUTH_PARAM_PREFIX "svn:auth:"
/** @brief Any 'default' credentials that came in through the application
* itself, (e.g. --username and --password options). Property values are
* const char *. */
#define SVN_AUTH_PARAM_DEFAULT_USERNAME SVN_AUTH_PARAM_PREFIX "username"
#define SVN_AUTH_PARAM_DEFAULT_PASSWORD SVN_AUTH_PARAM_PREFIX "password"
/** @brief The application doesn't want any providers to prompt
* users. Property value is irrelevant; only property's existence
* matters. */
#define SVN_AUTH_PARAM_NON_INTERACTIVE SVN_AUTH_PARAM_PREFIX "non-interactive"
/** @brief The application doesn't want any providers to save passwords
* to disk. Property value is irrelevant; only property's existence
* matters. */
#define SVN_AUTH_PARAM_DONT_STORE_PASSWORDS SVN_AUTH_PARAM_PREFIX \
"dont-store-passwords"
/** @brief The application doesn't want any providers to save credentials
* to disk. Property value is irrelevant; only property's existence
* matters. */
#define SVN_AUTH_PARAM_NO_AUTH_CACHE SVN_AUTH_PARAM_PREFIX "no-auth-cache"
/** @brief The following property is for SSL server cert providers. This
* provides a pointer to an @c apr_uint32_t containing the failures
* detected by the certificate validator. */
#define SVN_AUTH_PARAM_SSL_SERVER_FAILURES SVN_AUTH_PARAM_PREFIX \
"ssl:failures"
/** @brief The following property is for SSL server cert providers. This
* provides the cert info (svn_auth_ssl_server_cert_info_t). */
#define SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO SVN_AUTH_PARAM_PREFIX \
"ssl:cert-info"
/** Some providers need access to the @c svn_config_t configuration. */
#define SVN_AUTH_PARAM_CONFIG SVN_AUTH_PARAM_PREFIX "config"
/** The current server group. */
#define SVN_AUTH_PARAM_SERVER_GROUP SVN_AUTH_PARAM_PREFIX "server-group"
/** @brief A configuration directory that overrides the default
* ~/.subversion. */
#define SVN_AUTH_PARAM_CONFIG_DIR SVN_AUTH_PARAM_PREFIX "config-dir"
/** Get an initial set of credentials.
*
* Ask @a auth_baton to set @a *credentials to a set of credentials
* defined by @a cred_kind and valid within @a realmstring, or NULL if
* no credentials are available. Otherwise, return an iteration state
* in @a *state, so that the caller can call @c
* svn_auth_next_credentials, in case the first set of credentials
* fails to authenticate.
*
* Use @a pool to allocate @a *state, and for temporary allocation.
* Note that @a *credentials will be allocated in @a auth_baton's pool.
*/
svn_error_t * svn_auth_first_credentials(void **credentials,
svn_auth_iterstate_t **state,
const char *cred_kind,
const char *realmstring,
svn_auth_baton_t *auth_baton,
apr_pool_t *pool);
/** Get another set of credentials, assuming previous ones failed to
* authenticate.
*
* Use @a state to fetch a different set of @a *credentials, as a
* follow-up to @c svn_auth_first_credentials or @c
* svn_auth_next_credentials. If no more credentials are available,
* set @a *credentials to NULL.
*
* Note that @a *credentials will be allocated in @c auth_baton's pool.
*/
svn_error_t * svn_auth_next_credentials(void **credentials,
svn_auth_iterstate_t *state,
apr_pool_t *pool);
/** Save a set of credentials.
*
* Ask @a state to store the most recently returned credentials,
* presumably because they successfully authenticated. Use @a pool
* for temporary allocation. If no credentials were ever returned, do
* nothing.
*/
svn_error_t * svn_auth_save_credentials(svn_auth_iterstate_t *state,
apr_pool_t *pool);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_AUTH_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -