~ubuntu-branches/ubuntu/maverick/krb5/maverick

« back to all changes in this revision

Viewing changes to src/windows/identity/doc/cred_aquisition.h

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman, Russ Allbery, Sam Hartman
  • Date: 2008-08-21 10:41:41 UTC
  • mfrom: (11.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080821104141-a0f9c4o4cpo8xd0o
Tags: 1.6.dfsg.4~beta1-4
[ Russ Allbery ]
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #487669, #491774)
  - Italian, thanks Luca Monducci.  (Closes: #493962)

[ Sam Hartman ]
* Translation Updates:
    - Dutch, Thanks Vincent Zweije, Closes: #495733

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (c) 2005 Massachusetts Institute of Technology
 
3
 * Copyright (c) 2007 Secure Endpoints Inc.
3
4
 *
4
5
 * Permission is hereby granted, free of charge, to any person
5
6
 * obtaining a copy of this software and associated documentation
26
27
 
27
28
/*! \page cred_acq Managed credential acquisition
28
29
 
29
 
    Credential providers and the identity provider must participate in
 
30
    Credential providers and identity providers must participate in
30
31
    managed credential acquisition in order to respond to the user's
31
 
    requests to obtain new credentials for an identity or to obtain
32
 
    new credentials for an existing identity.
 
32
    requests to obtain new credentials for an identity or to renew
 
33
    credentials for an existing identity.
33
34
 
34
35
    There are two major processes that result in managed credential
35
 
    acuqisition.  One is the acquisition of initial credentials, while
36
 
    the other is the acquisition of new crednetials.  Both processes
37
 
    acquire new credentials (or replace existing credentials with new
38
 
    ones). The difference between the two processes lie in the way the
39
 
    new credentials are obtained.  Initial credentials are obtained
40
 
    using user supplied username and password while new credentials
41
 
    are obtained using other existing credentials.
 
36
    acuqisition.  One is the acquisition of credentials, while the
 
37
    other is credential renewal.  During a renewal, existing
 
38
    credentials are used to obtain new credentials which expire later
 
39
    than the existing credential.  Typically, the identity provider
 
40
    performs the task of obtaining renewed initial credentials while
 
41
    the other credential providers obtain new credentials based on
 
42
    these initial credentials.
42
43
 
43
 
    \section cred_acq_init Initial Credentials
 
44
    \section cred_acq_new New Credentials
44
45
 
45
46
    When a user initiates the process of initial credential
46
 
    acquisition, NetIDMgr broadcasts a
47
 
    <::KMSG_CRED,::KMSG_CRED_INITIAL_CREDS> message.  Credential
48
 
    providers which need to participate in the initial credential
49
 
    acquisition should respond to this message as detailed in 
50
 
    \ref cred_acq_handle.
51
 
 
52
 
    \section cred_acq_new New Credentials
53
 
 
54
 
    When a user initiates the process of obtaining new credentials
55
 
    based on existing credentials, NetIDMgr broadcasts a
 
47
    acquisition, Network Identity Manager broadcasts a
56
48
    <::KMSG_CRED,::KMSG_CRED_NEW_CREDS> message.  Credential providers
57
 
    which need to participate in the initial credential acquisition
58
 
    should respond to this message as detailed in \ref cred_acq_handle.
 
49
    which need to participate in the credential acquisition should
 
50
    respond to this message as detailed in \ref cred_acq_handle.
 
51
 
 
52
    \section cred_acq_renew Renew Credentials
 
53
 
 
54
    Network Identity Manager broadcasts a
 
55
    <::KMSG_CRED,::KMSG_CRED_RENEW_CREDS> message to initiate the
 
56
    process of renewing credentials.  This may be triggered
 
57
    automatically or by a user action.  Credential providers which
 
58
    need to participate in the renewal should respond to this message
 
59
    as detailed in \ref cred_acq_handle.
59
60
 
60
61
    The following pages provide detailed information:
61
62
 
65
66
 
66
67
/*! \page cred_acq_new_resp Handling new credentials acquisition
67
68
 
68
 
    The process of acquiring new credentials whether they are initial
69
 
    credentials or not, happen as follows :
70
 
 
71
 
    - NetIDMgr creates a ::khui_new_creds object and a credentials
72
 
      acquisition window.
73
 
 
74
 
    - <::KMSG_CRED,::KMSG_CRED_INITIAL_CREDS> or
 
69
    The process of acquiring credentials happens as follows:
 
70
 
 
71
    - Network Identity Manager creates a ::khui_new_creds object and a
 
72
      credentials acquisition window.
 
73
 
 
74
    - <::KMSG_CRED,::KMSG_CRED_RENEW_CREDS> or
75
75
      <::KMSG_CRED,::KMSG_CRED_NEW_CREDS> is sent to all the
76
76
      credentials providers.
77
77
 
79
79
      for customizing their respective credential types.  The type,
80
80
      panel and any dependency information is populated into a
81
81
      ::khui_new_creds_by_type structure and added to the
82
 
      ::khui_new_creds structure.
 
82
      ::khui_new_creds structure. (See khui_cw_add_type()).
83
83
 
84
84
    - <::KMSG_CRED, ::KMSG_CRED_DIALOG_PRESTART> is sent to all the
85
 
      credentials providers.  Credentials providers should use this
86
 
      message to finialize initialization in preparation of showing
87
 
      the credentials acquisition window, such as by initializing the
88
 
      controls of the individual panels.
 
85
      credentials providers.
89
86
 
90
87
    - <::KMSG_CRED, ::KMSG_CRED_DIALOG_START> is sent to all the
91
88
      credentials providers.
95
92
      are done through ::KHUI_WM_NC_NOTIFY messages to the dialog
96
93
      procedures.
97
94
 
98
 
    - Once the dialog completes, NetIDMgr sends
99
 
      <::KMSG_CRED,::KMSG_CRED_DIALOG_END> message to all the
100
 
      credentials providers.  The UI portion ends here.  The
101
 
      individual dialog controls are destroyed as a result of the main
102
 
      credentials acquisition window being destroyed.
103
 
 
104
 
    - NetIDMgr posts <::KMSG_CRED,::KMSG_CRED_DIALOG_PROCESS> message
105
 
      to all the credentials providers.  Each provider should check if
106
 
      the user cancelled the dialog or indicated that the new
107
 
      credentials should be obtained and act accordingly.  The
108
 
      credentials provider is responsible for removing the
109
 
      ::khui_new_creds_by_type structre from the ::khui_new_creds
110
 
      structure and freeing up any resources it allocated earlier in
111
 
      preparation for obtaining new credentials.
 
95
    - Once the dialog processing is done, a ::WMNC_DIALOG_PREPROCESS
 
96
      message is sent to the dialog procedure.
 
97
 
 
98
    - Network Identity Manager posts
 
99
      <::KMSG_CRED,::KMSG_CRED_DIALOG_PROCESS> message to all the
 
100
      credentials providers.  Each provider should check if the user
 
101
      cancelled the dialog or indicated that the new credentials
 
102
      should be obtained and act accordingly.  The \c result field of
 
103
      the ::khui_new_creds structure will be set to either
 
104
      ::KHUI_NC_RESULT_PROCESS or ::KHUI_NC_RESULT_CANCEL to indicate
 
105
      whether the user wishes to acquire credentials or cancel the
 
106
      operation.
 
107
 
 
108
    - Once all the plug-ins have processed the <::KMSG_CRED,
 
109
      ::KMSG_CRED_DIALOG_PROCESS> message, the application checks
 
110
      whether the new credentials dialog should continue processing,
 
111
      or whether the dialog should be closed.  If the dialog should
 
112
      continue processing, then the dialog returns to the state it was
 
113
      in prior to the ::WMNC_DIALOG_PREPROCESS message was sent.  If
 
114
      the dialog should be closed, then a <::KMSG_CRED,
 
115
      ::KMSG_CRED_END> message is sent.
 
116
 
 
117
    - A <::KMSG_CRED, ::KMSG_CRED_END> message signals the end of the
 
118
      credentials acquisition process.  Each credentials provider is
 
119
      responsible for removing the ::khui_new_creds_by_type structre
 
120
      from the ::khui_new_creds structure and freeing up any resources
 
121
      it allocated earlier in preparation for obtaining new
 
122
      credentials.
112
123
 
113
124
    \section cred_acq_handle Responding to credential acquisition messages
114
125
 
 
126
    \subsection cred_acq_handle_init <::KMSG_CRED,::KMSG_CRED_NEW_CREDS> and <::KMSG_CRED,::KMSG_CRED_RENEW_CREDS> Messages
 
127
 
115
128
    The credential acquisition messages are
116
 
    <::KMSG_CRED,::KMSG_CRED_INITIAL_CREDS> and <::KMSG_CRED,
117
 
    ::KMSG_CRED_NEW_CREDS>.  They are structured as follows :
 
129
    <::KMSG_CRED,::KMSG_CRED_NEW_CREDS> and <::KMSG_CRED,
 
130
    ::KMSG_CRED_RENEW_CREDS>.  They are structured as follows:
118
131
 
119
132
    - \b type : ::KMSG_CRED
120
 
    - \b subtype: ::KMSG_CRED_INITIAL_CREDS or ::KMSG_CRED_NEW_CREDS
 
133
    - \b subtype: ::KMSG_CRED_NEW_CREDS or ::KMSG_CRED_RENEW_CREDS
121
134
    - \b uparam : 0 (unused)
122
135
    - \b vparam : a pointer to a ::khui_new_creds structure.
123
136
 
124
137
    The \a vparam parameter of the message, as shown above, is a
125
138
    pointer to a ::khui_new_creds structure.  You can use the \a
126
 
    subtype field of this structure to determine whether this is an
127
 
    initial credentials acquisition or a new credentials acquisition
128
 
    at any point.
 
139
    subtype field of this structure to determine whether this is a new
 
140
    credentials acquisition or a renewal.
129
141
 
130
142
    In response to this message, a credentials provider is expected to
131
143
    provide a configuration panel which the user can use to customize
132
144
    how the credentials of this type are to be obtained.  The panel is
133
 
    described by the ::khui_new_cred_panel structure.
 
145
    described by the ::khui_new_creds_by_type structure.
134
146
 
135
 
    \subsection cred_acq_panel_spec Specifying the credentials type panel
 
147
    \subsubsection cred_acq_panel_spec Specifying the credentials type panel
136
148
 
137
149
    The credentials type panel is used by the user to customize how
138
150
    credentials of the specified type are to be obtained.  The
139
 
    ::khui_new_cred_panel structure that describes the panel can be
 
151
    ::khui_new_creds_by_type structure that describes the panel can be
140
152
    used to specify a number of parameters that guide how the panel is
141
153
    to be displayed in the new credentials acquisition dialog.
142
154
 
143
155
    The \a name field defines a localized string that will be
144
 
    displayed in the tab control that houses the panel.  Optionally,
 
156
    displayed in the tab control that houses the panel.  If it is \a
 
157
    NULL, then the name of the credentials type is used.  Optionally,
145
158
    an icon can be specified in the \a icon field which will appear
146
159
    alongside the name.  A tooltip may be provided in the \a tooltip
147
160
    field which will be displayed when the user hovers the mouse over
155
168
    name).  Then the panels without a positive ordianl are arranged
156
169
    behind these in increasing order of \a name.
157
170
 
158
 
    The \a hwnd_panel field is used to specify the handle to the
159
 
    dialog or window of the panel.  The parent of this window should
160
 
    be set to the \a hwnd parameter of the ::khui_new_creds structure
161
 
    which is passed in to the message handler.
 
171
    Currently, the credentials provider must specify a dialog template
 
172
    that will be used to create the embedded dialog for configuring
 
173
    new credentials for the type.  This is done by setting the
 
174
    khui_new_creds_by_type::h_module, khui_new_creds_by_type::dlg_proc
 
175
    and khui_new_creds_by_type::dlg_template fields.
162
176
 
163
 
    Following is a code snippet which suggests how this could be done:
 
177
    Following is example code which suggests how this could be done:
164
178
 
165
179
    \code
166
180
       // Message handling code for KMSG_CRED_NEW_CREDS or
181
195
       t->icon = LoadIcon(my_hInstance, MAKEINTRESOURCE(IDI_PANEL_ICON));
182
196
       t->tooltip = L"Configure credentials of my type";
183
197
 
184
 
       t->hwnd_panel = CreateDialog(
185
 
           my_hInstance, 
186
 
           MAKEINTRESOURCE(IDD_MY_PANEL),
187
 
           c->hwnd,
188
 
           my_dialog_proc);
 
198
       // specify the dialog template to use
 
199
       t->h_module = my_hInstance;
 
200
       t->dlg_proc = my_dialog_procedure;
 
201
       t->dlg_template = MAKEINTRESOURCE(IDD_NEW_CREDS);
189
202
 
190
203
       if(KHM_FAILED(khui_cw_add_type(c,t))) {
191
204
           // handle error
195
208
    It is important to note that the ::khui_new_creds_by_type pointer
196
209
    that is passed into khui_cw_add_type() points to an allocated
197
210
    block of memory which should remain in memory until
198
 
    <::KMSG_CRED,::KMSG_CRED_DIALOG_PROCESS> message is received.
 
211
    <::KMSG_CRED,::KMSG_CRED_END> message is received.
199
212
 
200
213
    For information on how the dialog procedure should be written, see
201
214
    \ref cred_acq_dlgproc .
204
217
 
205
218
/*! \page cred_acq_dlgproc Writing the dialog procedure for a cred type panel
206
219
 
207
 
    
 
220
    Once each credentials provider has had a chance to add a
 
221
    credentials type panel for the new credentials dialog, the
 
222
    application will attempt to create all the dialog panels.  It will
 
223
    use the dialog template and the dialog procedure specified in the
 
224
    \c dlg_proc and \c dlg_template members of the
 
225
    ::khui_new_creds_by_type structure.
 
226
 
 
227
    The credentials type panel will be an ordinary dialog that is
 
228
    created as a child of the new credentials window.  Therefore, the
 
229
    dialog template should have the WS_CHILD style and the
 
230
    WS_EX_CONTROLPARENT extended style set so that the main dialog
 
231
    procedure can correctly navigate the child dialog.
 
232
 
 
233
    \section cred_acq_dlgmsg Handling Messages
 
234
 
 
235
    \subsection cred_acq_dlg_WM_INITDIALOG WM_INITDIALOG
 
236
 
 
237
    When the application creates a credentials type panel dialog, it
 
238
    passes a pointer to the ::khui_new_creds structure as the \c
 
239
    LPARAM parameter.  This can be used to query for the credentials
 
240
    type panel for the plug-in, as follows:
 
241
 
 
242
    \code
 
243
 
 
244
    // Handler for WM_INITDIALOG:
 
245
    // HWND hwnd, WPARAM wParam and LPARAM lParam
 
246
 
 
247
    khui_new_creds *         nc = NULL;
 
248
    khui_new_creds_by_type * nct = NULL;
 
249
 
 
250
    // We can define and use a structure like the following to
 
251
    // maintain the data that will be used to drive the dialog user
 
252
    // interface and to store credentials type settings:
 
253
    struct nc_dialog_data *  d = NULL;
 
254
 
 
255
    nc = (khui_new_creds *) lParam;
 
256
 
 
257
    // Now we can use nc to query for our credentials type structure
 
258
    khui_cw_find_type(nc, credtype_id, &nct);
 
259
 
 
260
    assert(nct);
 
261
 
 
262
    // The dialog data structure should live until we receive
 
263
    // WM_DESTROY.
 
264
    d = malloc(sizeof(*d));
 
265
    ZeroMemory(d, sizeof(*d));
 
266
 
 
267
    d->nc = nc;
 
268
    d->nct = nct;
 
269
 
 
270
    // Store it as our user data for the dialog.
 
271
    SetWindowLongPtr(hwnd, DWLP_USER, (LPARAM) d);
 
272
 
 
273
    // The aux member of the khui_new_creds_by_type structure is
 
274
    // reserved for use by the credentials provider.  We can use it to
 
275
    // store our dialog data.  This way, the dialog procedure and the
 
276
    // plug-in thread can both access it and use it to store
 
277
    // credential options for use when obtaining credentials.  The
 
278
    // dialog and the dialog data exist until KMSG_CRED_END is sent.
 
279
    nct->aux = (LPARAM) d;
 
280
 
 
281
    // We should return FALSE here to indicate that we don't want to
 
282
    // set keyboard focus to this dialog yet.  The application will
 
283
    // attempt to create all the credentials type panels as well as
 
284
    // the other child dialogs used for the new credentials opeartion.
 
285
    return FALSE;
 
286
 
 
287
    \endcode
 
288
 
 
289
    \subsection cred_acq_dlg_WM_NC_NOTIFY WM_NC_NOTIFY
 
290
 
 
291
    ::WM_NC_NOTIFY is a special window message that Network Identity
 
292
    Manager uses to communicate with credentials type panels.  The
 
293
    messages are listed in the ::khui_wm_nc_notifications enumeration.
 
294
    The format of the message is as follows:
 
295
 
 
296
    - uMsg : KHUI_WM_NC_NOTIFY
 
297
    - HIWORD(wParam) : one of ::khui_wm_nc_notifications
 
298
    - LPARAM : pointer to the ::khui_new_creds structure (except where noted)
 
299
 
 
300
    The ::WM_NC_NOTIFY notifications that a credentials provider is
 
301
    expected to handle are the following:
 
302
 
 
303
    - ::WMNC_IDENTITY_CHANGE
 
304
 
 
305
    \copydoc WMNC_IDENTITY_CHANGE
 
306
 
 
307
    - ::WMNC_DIALOG_MOVE
 
308
 
 
309
    \copydoc WMNC_DIALOG_MOVE
 
310
 
 
311
    - ::WMNC_UPDATE_CREDTEXT
 
312
 
 
313
    \copydoc WMNC_UPDATE_CREDTEXT
 
314
 
 
315
    - ::WMNC_CREDTEXT_LINK
 
316
 
 
317
    \copydoc WMNC_CREDTEXT_LINK
 
318
 
 
319
    - ::WMNC_DIALOG_PREPROCESS
 
320
 
 
321
    \copydoc WMNC_DIALOG_PREPROCESS
 
322
 
 
323
    \section cred_acq_other Other notes
 
324
 
208
325
*/