1/* 2 * Copyright (C) 2012 Intel Corporation. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 * THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26/** 27 * @file ewk_auth_request.h 28 * @brief Describes the Ewk Authentication Request API. 29 */ 30 31#ifndef ewk_auth_request_h 32#define ewk_auth_request_h 33 34#include <Eina.h> 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40/** 41 * Declare Ewk_Auth_Request as Ewk_Object. 42 * 43 * @see Ewk_Object 44 */ 45typedef struct EwkObject Ewk_Auth_Request; 46 47/** 48 * Queries the suggested username to be used for authenticating. 49 * 50 * @param request request object to query 51 * 52 * @return the username pointer, that may be @c NULL. This pointer is 53 * guaranteed to be eina_stringshare, so whenever possible 54 * save yourself some cpu cycles and use 55 * eina_stringshare_ref() instead of eina_stringshare_add() or 56 * strdup() 57 */ 58EAPI const char *ewk_auth_request_suggested_username_get(const Ewk_Auth_Request *request); 59 60/** 61 * Queries if this an authentication attempt retrying. 62 * 63 * @param request request object to query 64 * 65 * @return @c EINA_TRUE if this is not the first authentication attempt 66 * and we are trying, @c EINA_FALSE otherwise. 67 */ 68EAPI Eina_Bool ewk_auth_request_retrying_get(const Ewk_Auth_Request *request); 69 70/** 71 * Queries the authentication realm. 72 * 73 * @param request request object to query 74 * 75 * @return the realm pointer, that may be @c NULL. This pointer is 76 * guaranteed to be eina_stringshare, so whenever possible 77 * save yourself some cpu cycles and use 78 * eina_stringshare_ref() instead of eina_stringshare_add() or 79 * strdup() 80 */ 81EAPI const char *ewk_auth_request_realm_get(const Ewk_Auth_Request *request); 82 83/** 84 * Queries the host requiring the authentication. 85 * 86 * @param request request object to query 87 * 88 * @return the host pointer, that may be @c NULL. This pointer is 89 * guaranteed to be eina_stringshare, so whenever possible 90 * save yourself some cpu cycles and use 91 * eina_stringshare_ref() instead of eina_stringshare_add() or 92 * strdup() 93 */ 94EAPI const char *ewk_auth_request_host_get(const Ewk_Auth_Request *request); 95 96/** 97 * Cancels the authentication request. 98 * 99 * @param request request object to cancel 100 * 101 * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise 102 */ 103EAPI Eina_Bool ewk_auth_request_cancel(Ewk_Auth_Request *request); 104 105/** 106 * Set credential for the authentication request. 107 * 108 * @param request request object to update 109 * 110 * @return @c EINA_TRUE if the credential was successfuly sent, @c EINA_FALSE otherwise. 111 */ 112EAPI Eina_Bool ewk_auth_request_authenticate(Ewk_Auth_Request *request, const char *username, const char *password); 113 114#ifdef __cplusplus 115} 116#endif 117 118#endif /* ewk_auth_request_h */ 119