summaryrefslogtreecommitdiffstats
path: root/docs/reference/tmpl/login.sgml
blob: e6992614f6132eae3773206c174f433bfe0cab3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!-- ##### SECTION Title ##### -->
LassoLogin

<!-- ##### SECTION Short_Description ##### -->
Single Sign-On and Federation Profile

<!-- ##### SECTION Long_Description ##### -->
<para>
The Single Sign On process allows a user to log in once to an identity provider
(IdP), and to be then transparently loged in to the required service providers
(SP) belonging to the IP "circle of trust".  Subordinating different identities
of the same user within a circle of trust to a unique IP is called "Identity
Federation".  The liberty Alliance specifications allows, thanks to this
federation, strong and unique authentication coupled with control by the user
of his personnal informations. The explicit user agreement is necessary before
proceeding to Identity Federation.
</para>

<para>
The service provider must implement the following process:
<itemizedlist>
 <listitem><para>creating an authentication request (#LassoLibAuthnRequest) with
 lasso_login_init_authn_request();</para></listitem>
 <listitem><para>sending it to the identity provider with
 lasso_login_build_authn_request_msg();</para></listitem>
 <listitem><para>receiving and processing the answer:
   <itemizedlist>
     <listitem>either an authentication response with
     lasso_login_process_authn_response_msg()</listitem>
     <listitem>or an artifact with lasso_login_init_request() then sending the
     request to the IdP with lasso_login_build_request_msg() and processing the
     new answer with lasso_login_process_response_msg().</listitem>
   </itemizedlist>
   </para></listitem>
</itemizedlist>
</para>

<example>
<title>Service Provider Login URL</title>
<programlisting>
LassoLogin *login;

login = lasso_login_new(server);
lasso_login_init_authn_request(login, "http://identity-provider-id/",
		LASSO_HTTP_METHOD_REDIRECT);

/* customize AuthnRequest */
request = LASSO_LIB_AUTHN_REQUEST(LASSO_PROFILE(login)->request);
request->NameIDPolicy = strdup(LASSO_LIB_NAMEID_POLICY_TYPE_FEDERATED);
request->ForceAuthn = TRUE;
request->IsPassive = FALSE;
request->ProtocolProfile = strdup(LASSO_LIB_PROTOCOL_PROFILE_BRWS_ART);

lasso_login_build_authn_request_msg(login);

/* redirect user to identity provider */
printf("Location: %s\n\nRedirected to IdP\n", LASSO_PROFILE(login)->msg_url);
</programlisting>
</example>

<example>
<title>Service Provider Assertion Consumer Service URL</title>
<programlisting>
LassoLogin *login;
char *request_method = getenv("REQUEST_METHOD");
char *artifact_msg = NULL, *lares = NULL, *lareq = NULL;
char *name_identifier;
lassoHttpMethod method;

login = lasso_login_new(server);
if (strcmp(request_method, "GET") == 0) {
	artifact_msg = getenv("QUERY_STRING");
	method = LASSO_HTTP_METHOD_REDIRECT;
} else {
	/* read submitted form; if it has a LAREQ field, put it in lareq,
	 * if it has a LARES field, put it in lares */
	if (lareq) {
		artifact_msg = lareq;
	} else if (lares) {
		response_msg = lares;
	} else {
		/* bail out */
	}
	method = LASSO_HTTP_METHOD_POST;
}

if (artifact_msg) {
	lasso_login_init_request(login, artifact_msg, method);
	lasso_login_build_request_msg(login);
	/* makes a SOAP call, soap_call is NOT a Lasso function */
	soap_answer_msg = soap_call(LASSO_PROFILE(login)->msg_url,
			LASSO_PROFILE(login)->msg_body);
	lasso_login_process_response_msg(login, soap_answer_msg);
} else if (response_msg) {
	lasso_login_process_authn_response_msg(login, response_msg);
}

/* looks up name_identifier in local file, database, whatever and gets back
 * two things: identity_dump and session_dump */
name_identifier = LASSO_PROFILE(login)->nameIdentifier
lasso_profile_set_identity_from_dump(LASSO_PROFILE(login), identity_dump);
lasso_profile_set_session_from_dump(LASSO_PROFILE(login), session_dump);

lasso_login_accept_sso(login);

if (lasso_profile_is_identity_dirty(LASSO_PROFILE(login))) {
	LassoIdentity *identity;
	char *identity_dump;
	identity = lasso_profile_get_identity(LASSO_PROFILE(login));
	identity_dump = lasso_identity_dump(identity);
	/* record identity_dump in file, database... */
}

if (lasso_profile_is_session_dirty(LASSO_PROFILE(login))) {
	LassoSession *session;
	char *session_dump;
	session = lasso_profile_get_session(LASSO_PROFILE(login));
	session_dump = lasso_session_dump(session);
	/* record session_dump in file, database... */
}

/* redirect user anywhere */
printf("Location: /\n\nRedirected to site root\n");
</programlisting>
</example>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### STRUCT LassoLogin ##### -->
<para>
Single sign-on profile for the current transaction; possibly an
assertionArtifact to be used by the service provider in its
"assertionConsumerServiceURL" and the assertion created or received for the
principal.
</para>

@protocolProfile: 
@assertionArtifact: 
@assertion: 

<!-- ##### ENUM LassoLoginProtocolProfile ##### -->
<para>
Identifies the two possible profiles for Single Sign-On and Federation.
</para>

@LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_ART: 
@LASSO_LOGIN_PROTOCOL_PROFILE_BRWS_POST: 

<!-- ##### FUNCTION lasso_login_new ##### -->
<para>

</para>

@server: 
@Returns: 


<!-- ##### FUNCTION lasso_login_destroy ##### -->
<para>

</para>

@login: 


<!-- ##### FUNCTION lasso_login_dump ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_new_from_dump ##### -->
<para>

</para>

@server: 
@dump: 
@Returns: 


<!-- ##### FUNCTION lasso_login_accept_sso ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_build_artifact_msg ##### -->
<para>

</para>

@login: 
@http_method: 
@Returns: 


<!-- ##### FUNCTION lasso_login_build_assertion ##### -->
<para>

</para>

@login: 
@authenticationMethod: 
@authenticationInstant: 
@reauthenticateOnOrAfter: 
@notBefore: 
@notOnOrAfter: 
@Returns: 


<!-- ##### FUNCTION lasso_login_build_authn_request_msg ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_build_authn_response_msg ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_build_request_msg ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_build_response_msg ##### -->
<para>

</para>

@login: 
@remote_providerID: 
@Returns: 


<!-- ##### FUNCTION lasso_login_init_authn_request ##### -->
<para>

</para>

@login: 
@remote_providerID: 
@http_method: 
@Returns: 


<!-- ##### FUNCTION lasso_login_init_idp_initiated_authn_request ##### -->
<para>

</para>

@login: 
@remote_providerID: 
@Returns: 


<!-- ##### FUNCTION lasso_login_init_request ##### -->
<para>

</para>

@login: 
@response_msg: 
@response_http_method: 
@Returns: 


<!-- ##### FUNCTION lasso_login_must_ask_for_consent ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_must_authenticate ##### -->
<para>

</para>

@login: 
@Returns: 


<!-- ##### FUNCTION lasso_login_process_authn_request_msg ##### -->
<para>

</para>

@login: 
@authn_request_msg: 
@Returns: 


<!-- ##### FUNCTION lasso_login_process_authn_response_msg ##### -->
<para>

</para>

@login: 
@authn_response_msg: 
@Returns: 


<!-- ##### FUNCTION lasso_login_process_request_msg ##### -->
<para>

</para>

@login: 
@request_msg: 
@Returns: 


<!-- ##### FUNCTION lasso_login_process_response_msg ##### -->
<para>

</para>

@login: 
@response_msg: 
@Returns: 


<!-- ##### FUNCTION lasso_login_validate_request_msg ##### -->
<para>

</para>

@login: 
@authentication_result: 
@is_consent_obtained: 
@Returns: 


<!-- ##### FUNCTION lasso_login_set_encryptedResourceId ##### -->
<para>

</para>

@login: 
@encryptedResourceId: 
@Returns: 


<!-- ##### FUNCTION lasso_login_set_resourceId ##### -->
<para>

</para>

@login: 
@content: 
@Returns: 
<!-- # Unused Parameters # -->
@resourceId: