1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
4 * This file is part of libgsignon-glib
6 * Copyright (C) 2009-2010 Nokia Corporation.
7 * Copyright (C) 2012 Canonical Ltd.
8 * Copyright (C) 2012 Intel Corporation.
10 * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
11 * Contact: Jussi Laako <jussi.laako@linux.intel.com>
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public License
15 * version 2.1 as published by the Free Software Foundation.
17 * This library is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 #ifndef _SIGNONINTERNALS_H_
29 #define _SIGNONINTERNALS_H_
31 #include "signon-security-context.h"
38 #define DEBUG(format...) g_debug (G_STRLOC ": " format)
40 #define DEBUG(...) do {} while (0)
44 * Common DBUS definitions
46 #define SIGNOND_SERVICE_PREFIX "com.google.code.AccountsSSO.gSingleSignOn"
47 #define SIGNOND_SERVICE SIGNOND_SERVICE_PREFIX
49 #define SIGNOND_DAEMON_OBJECTPATH "/com/google/code/AccountsSSO/gSingleSignOn"
50 #define SIGNOND_DAEMON_INTERFACE SIGNOND_SERVICE_PREFIX ".AuthService"
51 #define SIGNOND_IDENTITY_INTERFACE SIGNOND_SERVICE_PREFIX ".Identity"
52 #define SIGNOND_AUTH_SESSION_INTERFACE SIGNOND_SERVICE_PREFIX ".AuthSession"
54 #define SIGNOND_ERR_PREFIX SIGNOND_SERVICE_PREFIX ".Error."
57 * Common server/client identity info strings
59 #define SIGNOND_IDENTITY_INFO_ID "Id"
60 #define SIGNOND_IDENTITY_INFO_USERNAME "UserName"
61 #define SIGNOND_IDENTITY_INFO_SECRET "Secret"
62 #define SIGNOND_IDENTITY_INFO_STORESECRET "StoreSecret"
63 #define SIGNOND_IDENTITY_INFO_CAPTION "Caption"
64 #define SIGNOND_IDENTITY_INFO_REALMS "Realms"
65 #define SIGNOND_IDENTITY_INFO_AUTHMETHODS "AuthMethods"
66 #define SIGNOND_IDENTITY_INFO_OWNER "Owner"
67 #define SIGNOND_IDENTITY_INFO_ACL "ACL"
68 #define SIGNOND_IDENTITY_INFO_TYPE "Type"
69 #define SIGNOND_IDENTITY_INFO_REFCOUNT "RefCount"
70 #define SIGNOND_IDENTITY_INFO_VALIDATED "Validated"
71 #define SIGNOND_IDENTITY_INFO_USERNAME_IS_SECRET "UserNameSecret"
74 * Common server/client sides error names and messages
76 #define SIGNOND_UNKNOWN_ERR_NAME SIGNOND_ERR_PREFIX "Unknown"
77 #define SIGNOND_INTERNAL_SERVER_ERR_NAME SIGNOND_ERR_PREFIX "InternalServer"
78 #define SIGNOND_INTERNAL_COMMUNICATION_ERR_NAME \
79 SIGNOND_ERR_PREFIX "InternalCommunication"
80 #define SIGNOND_PERMISSION_DENIED_ERR_NAME \
81 SIGNOND_ERR_PREFIX "PermissionDenied"
82 #define SIGNOND_METHOD_OR_MECHANISM_NOT_ALLOWED_ERR_NAME \
83 SIGNOND_ERR_PREFIX "MethodOrMechanismNotAllowed"
84 #define SIGNOND_ENCRYPTION_FAILED_ERR_NAME \
85 SIGNOND_ERR_PREFIX "EncryptionFailed"
86 #define SIGNOND_METHOD_NOT_KNOWN_ERR_NAME SIGNOND_ERR_PREFIX "MethodNotKnown"
87 #define SIGNOND_SERVICE_NOT_AVAILABLE_ERR_NAME \
88 SIGNOND_ERR_PREFIX "ServiceNotAvailable"
89 #define SIGNOND_INVALID_QUERY_ERR_NAME SIGNOND_ERR_PREFIX "InvalidQuery"
90 #define SIGNOND_METHOD_NOT_AVAILABLE_ERR_NAME \
91 SIGNOND_ERR_PREFIX "MethodNotAvailable"
92 #define SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME \
93 SIGNOND_ERR_PREFIX "IdentityNotFound"
94 #define SIGNOND_STORE_FAILED_ERR_NAME SIGNOND_ERR_PREFIX "StoreFailed"
95 #define SIGNOND_REMOVE_FAILED_ERR_NAME SIGNOND_ERR_PREFIX "RemoveFailed"
96 #define SIGNOND_SIGNOUT_FAILED_ERR_NAME SIGNOND_ERR_PREFIX "SignOutFailed"
97 #define SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME \
98 SIGNOND_ERR_PREFIX "IdentityOperationCanceled"
99 #define SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME \
100 SIGNOND_ERR_PREFIX "CredentialsNotAvailable"
101 #define SIGNOND_REFERENCE_NOT_FOUND_ERR_NAME \
102 SIGNOND_ERR_PREFIX "ReferenceNotFound"
103 #define SIGNOND_MECHANISM_NOT_AVAILABLE_ERR_NAME \
104 SIGNOND_ERR_PREFIX "MechanismNotAvailable"
105 #define SIGNOND_MISSING_DATA_ERR_NAME SIGNOND_ERR_PREFIX "MissingData"
106 #define SIGNOND_INVALID_CREDENTIALS_ERR_NAME \
107 SIGNOND_ERR_PREFIX "InvalidCredentials"
108 #define SIGNOND_NOT_AUTHORIZED_ERR_NAME SIGNOND_ERR_PREFIX "NotAuthorized"
109 #define SIGNOND_WRONG_STATE_ERR_NAME SIGNOND_ERR_PREFIX "WrongState"
110 #define SIGNOND_OPERATION_NOT_SUPPORTED_ERR_NAME \
111 SIGNOND_ERR_PREFIX "OperationNotSupported"
112 #define SIGNOND_NO_CONNECTION_ERR_NAME SIGNOND_ERR_PREFIX "NoConnection"
113 #define SIGNOND_NETWORK_ERR_NAME SIGNOND_ERR_PREFIX "Network"
114 #define SIGNOND_SSL_ERR_NAME SIGNOND_ERR_PREFIX "Ssl"
115 #define SIGNOND_RUNTIME_ERR_NAME SIGNOND_ERR_PREFIX "Runtime"
116 #define SIGNOND_SESSION_CANCELED_ERR_NAME SIGNOND_ERR_PREFIX "SessionCanceled"
117 #define SIGNOND_TIMED_OUT_ERR_NAME SIGNOND_ERR_PREFIX "TimedOut"
118 #define SIGNOND_USER_INTERACTION_ERR_NAME SIGNOND_ERR_PREFIX "UserInteraction"
119 #define SIGNOND_OPERATION_FAILED_ERR_NAME SIGNOND_ERR_PREFIX "OperationFailed"
120 #define SIGNOND_TOS_NOT_ACCEPTED_ERR_NAME SIGNOND_ERR_PREFIX "TOSNotAccepted"
121 #define SIGNOND_FORGOT_PASSWORD_ERR_NAME SIGNOND_ERR_PREFIX "ForgotPassword"
122 #define SIGNOND_INCORRECT_DATE_ERR_NAME SIGNOND_ERR_PREFIX "IncorrectDate"
123 #define SIGNOND_USER_ERROR_ERR_NAME SIGNOND_ERR_PREFIX "User"
126 #include "signon-identity-info.h"
130 enum SignonAuthSessionState {
131 SIGNON_AUTH_SESSION_STATE_NOT_STARTED = 0, /**< No message. */
132 SIGNON_AUTH_SESSION_STATE_RESOLVING_HOST, /**< Resolving remote server
134 SIGNON_AUTH_SESSION_STATE_CONNECTING, /**< Connecting to remote
136 SIGNON_AUTH_SESSION_STATE_SENDING_DATA, /**< Sending data to remote
138 SIGNON_AUTH_SESSION_STATE_WAITING_REPLY, /**< Waiting reply from remote
140 SIGNON_AUTH_SESSION_STATE_USER_PENDING, /**< Waiting response from
142 SIGNON_AUTH_SESSION_STATE_UI_REFRESHING, /**< Refreshing ui request. */
143 SIGNON_AUTH_SESSION_STATE_PROCESS_PENDING, /**< Waiting another process
145 SIGNON_AUTH_SESSION_STATE_STARTED, /**< Authentication session is
147 SIGNON_AUTH_SESSION_STATE_PROCESS_CANCELING, /**< Canceling.current
149 SIGNON_AUTH_SESSION_STATE_PROCESS_DONE, /**< Authentication
151 SIGNON_AUTH_SESSION_STATE_CUSTOM, /**< Custom message. */
152 SIGNON_AUTH_SESSION_STATE_LAST
155 struct _SignonIdentityInfo
161 gboolean store_secret;
164 SignonSecurityContext *owner;
165 SignonSecurityContextList *access_control_list;
171 signon_identity_info_new_from_variant (GVariant *variant);
175 signon_identity_info_to_variant (const SignonIdentityInfo *self);