summaryrefslogtreecommitdiffstats
path: root/python/lasso.py
blob: b9869cc2f0890cf80cafa45288bacf3df601e174 (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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# $Id$
#
# PyLasso - Python bindings for Lasso Library
#
# Copyright (C) 2003-2004 Easter-eggs, Valery Febvre
# http://lasso.entrouvert.org
#
# Author: Valery Febvre <vfebvre@easter-eggs.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

__docformat__ = "plaintext en"

import lassomod
from lasso_strings import *

_initialized = False


################################################################################
# Lasso Errors
################################################################################


class Error(Exception):
    code = None # Use positive error codes for binding specific errors.
    functionName = None

    def __init__(self, functionName):
        self.functionName = functionName

    def __str__(self):
        return repr(self.msg)


class ErrorUnknown(Error):
    def __init__(self, code, functionName):
        Error.__init__(self, functionName)
        self.code = code

    def __str__(self):
        return 'Unknown error number %d in Lasso function %s' % (self.code, self.functionName)


class ErrorLassoAlreadyInitialized(Error):
    code = 1
    msg = 'Lasso already initialized'


class ErrorLassoNotInitialized(Error):
    code = 2
    msg = 'Lasso not initialized or already shotdown'

    
class ErrorInstanceCreationFailed(Error):
    code = 3

    def __str__(self, functionName):
        return 'Instance creation failed in Lasso function %s()' % self.functionName


def newError(code, functionName):
    # FIXME: Use proper ErrorClass, when Lasso will have well defined error codes.
    return ErrorUnknown(code, functionName)


################################################################################
# Initialization
################################################################################


def init():
    """
    Init Lasso Library.
    """
    global _initialized
    if _initialized:
        raise ErrorLassoAlreadyInitialized()
    _initialized = True
    return lassomod.init()


def shutdown():
    """
    Shutdown Lasso Library.
    """
    global _initialized
    if not _initialized:
        raise ErrorLassoNotInitialized()
    _initialized = False
    return lassomod.shutdown()


################################################################################
# xml: low level classes
################################################################################


# Export types
NodeExportTypeXml    = 1
NodeExportTypeBase64 = 2
NodeExportTypeQuery  = 3
NodeExportTypeSoap   = 4

class Node:
    """\brief The base class of the Lasso hierarchy.

    Node is the base class for all Lasso classes.
    """

    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        
    def destroy(self):
        """
        Destroys the node.
        """
        lassomod.node_destroy(self)

    def dump(self, encoding="utf8", format=0):
        """
        Dumps the node. All datas in object are dumped in an XML format.

        \param encoding the name of the encoding to use or None.
        \param format is formatting allowed?
        \return an XML dump of the node
        """
        return lassomod.node_dump(self, encoding, format)

    def export(self):
        """
        Exports the node.

        \return an XML dump of the node (UTF-8 encoded)
        """
        return lassomod.node_export(self)

    def export_to_base64(self):
        """
        Like export() method except that result is Base64 encoded.

        \return a Base64 encoded export of the node
        """
        return lassomod.node_export_to_base64(self)

    def export_to_query(self, sign_method=0, private_key_file=None):
        """
        URL-encodes and signes the node.
        If private_key_file is None, query won't be signed.

        \param sign_method the Signature transform method
        \param private_key_file a private key
        \return a query
        """
        return lassomod.node_export_to_query(self, sign_method, private_key_file)

    def export_to_soap(self):
        """
        Like export() method except that result is SOAP enveloped.

        \return a SOAP enveloped export of the node
        """
        return lassomod.node_export_to_soap(self)

    def get_attr_value(self, name):
        """
        Gets the value of an attribute associated to node.
        
        \param name an attribut name
        \return the attribut value or None if not found.
        """
        return lassomod.node_get_attr_value(self, name)

    def get_child(self, name, href=None):
        """
        Gets child of node having given \a name and namespace \a href.

        \param name the child name
        \param href the namespace
        \return a child node
        """
        obj = lassomod.node_get_child(self, name, href)
        if obj:
            return Node(_obj=obj)
        return None

    def get_content(self):
        """
        Read the value of node, this can be either the text carried directly by
        this node if it's a TEXT node or the aggregate string of the values carried
        by this node child's (TEXT and ENTITY_REF). Entity references are
        substituted.

        \return a string or None if no content is available.
        """
        return lassomod.node_get_content(self)

    def verify_signature(self, certificate_file):
        """
        Verify the node signature.

        \param certificate_file a certificate
        \return 1 if signature is valid, 0 if invalid. -1 if an error occurs.
        """
        return lassomod.node_verify_signature(self, certificate_file)


class SamlAssertion(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.saml_assertion_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_saml_assertion_new')
        Node.__init__(self, _obj=_obj)

    def add_authenticationStatement(self, authenticationStatement):
        """
        bla bla
        """
        lassomod.saml_assertion_add_authenticationStatement(self,
                                                            authenticationStatement)

    def set_signature(self, sign_method, private_key_file, certificate_file):
        lassomod.saml_assertion_set_signature(self, sign_method,
                                              private_key_file, certificate_file)


class SamlAuthenticationStatement(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.saml_authentication_statement_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_saml_authentication_statement_new')
        Node.__init__(self, _obj=_obj)


class SamlNameIdentifier(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.saml_name_identifier_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_saml_name_identifier_new')
        Node.__init__(self, _obj=_obj)

    def set_format(self, format):
        lassomod.saml_name_identifier_set_format(self, format)
    
    def set_nameQualifier(self, nameQualifier):
        lassomod.saml_name_identifier_set_nameQualifier(self, nameQualifier)


class SamlpResponse(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.samlp_response_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_samlp_response_new')
        Node.__init__(self, _obj=_obj)

    def add_assertion(self, assertion):
        lassomod.samlp_response_add_assertion(self, assertion)


class LibAuthenticationStatement(SamlAuthenticationStatement):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_authentication_statement_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_saml_authentication_statement_new')
        SamlAuthenticationStatement.__init__(self, _obj=_obj)
    def set_sessionIndex(self, sessionIndex):
        lassomod.lib_authentication_statement_set_sessionIndex(self, sessionIndex)


class LibAuthnRequest(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_authn_request_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_authn_request_new')
        Node.__init__(self, _obj=_obj)
        
    def set_consent(self, consent):
        lassomod.lib_authn_request_set_consent(self, consent)

    def set_forceAuthn(self, forceAuthn):
        lassomod.lib_authn_request_set_forceAuthn(self, forceAuthn)

    def set_isPassive(self, isPassive):
        lassomod.lib_authn_request_set_isPassive(self, isPassive)

    def set_nameIDPolicy(self, nameIDPolicy):
        lassomod.lib_authn_request_set_nameIDPolicy(self, nameIDPolicy)

    def set_protocolProfile(self, protocolProfile):
        lassomod.lib_authn_request_set_protocolProfile(self, protocolProfile)

    def set_relayState(self, relayState):
        lassomod.lib_authn_request_set_relayState(self, relayState)


class LibAuthnResponse(SamlpResponse):
    """\brief Blabla

    Bla bla
    """

    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_authn_response_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_authn_response_new')
        SamlpResponse.__init__(self, _obj=_obj)


class LibFederationTerminationNotification(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_federation_termination_notification_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_federation_termination_notification_new')
        Node.__init__(self, _obj=_obj)

    def set_consent(self, consent):
        lassomod.lib_federation_termination_notification_set_consent(self, consent)


class LibLogoutRequest(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_logout_request_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_logout_request_new')
        Node.__init__(self, _obj=_obj)

    def set_consent(self, consent):
        lassomod.lib_logout_request_set_consent(self, consent)

    def set_nameIdentifier(self, nameIdentifier):
        lassomod.lib_logout_request_set_nameIdentifier(self, nameIdentifier)

    def set_providerID(self, providerID):
        lassomod.lib_logout_request_set_providerID(self, providerID)

    def set_relayState(self, relayState):
        lassomod.lib_logout_request_set_relayState(self, relayState)

    def set_sessionIndex(self, sessionIndex):
        lassomod.lib_logout_request_set_sessionIndex(self, sessionIndex)


class LibLogoutResponse(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj = None):
        if _obj!=None:
            self._o = _obj
            return

        _obj = lassomod.lib_logout_response_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_logout_response_new')
        Node.__init__(self, _obj = _obj)
        

class LibNameIdentifierMappingRequest(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_name_identifier_mapping_request_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_name_identifier_mapping_request_new')
        Node.__init__(self, _obj=_obj)

    def set_consent(self, consent):
        lassomod.lib_name_identifier_mapping_request_set_consent(self, consent)


class LibNameIdentifierMappingResponse(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj = None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_name_identifier_mapping_response_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_name_identifier_mapping_response_new')
        Node.__init__(self, _obj=_obj)


class LibRegisterNameIdentifierRequest(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_register_name_identifier_request_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_register_name_identifier_request_new')
        Node.__init__(self, _obj=_obj)


class LibRegisterNameIdentifierResponse(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj = None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.lib_register_name_identifier_response_new()
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_lib_register_name_identifier_response_new')
        Node.__init__(self, _obj=_obj)


################################################################################
# protocols: middle level classes
################################################################################


def authn_request_get_protocolProfile(query):
    return lassomod.authn_request_get_protocolProfile(query)


class AuthnRequest(LibAuthnRequest):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, providerID, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.authn_request_new(providerID)
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_authn_request_new')
        LibAuthnRequest.__init__(self, _obj=_obj)
    
    def set_requestAuthnContext(self, authnContextClassRefs=None,
                                authnContextStatementRefs=None,
                                authnContextComparison=None):
        lassomod.authn_request_set_requestAuthnContext(self,
                                                       authnContextClassRefs,
                                                       authnContextStatementRefs,
                                                       authnContextComparison)

    def set_scoping(self, proxyCount):
        lassomod.authn_request_set_scoping(self, proxyCount)


class AuthnResponse(SamlpResponse):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        SamlpResponse.__init__(self, _obj=_obj)

    def new_from_export(cls, buffer, type=0):
        obj = lassomod.authn_response_new_from_export(buffer, type)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_authn_response_new_from_export')
        return AuthnResponse(obj)
    new_from_export = classmethod(new_from_export)


class FederationTerminationNotification(LibFederationTerminationNotification):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, obj):
        """
        The constructor
        """
        self._o = obj
        LibFederationTerminationNotification.__init__(self, _obj=self._o)

    def new(cls, providerID, nameIdentifier, nameQualifier, format):
        obj = lassomod.federation_termination_notification_new(
            providerID, nameIdentifier, nameQualifier, format)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_federation_termination_notification_new')
        return FederationTerminationNotification(obj)
    new = classmethod(new)

    def new_from_export(cls, buffer, export_type = 0):
        obj = lassomod.federation_termination_notification_new_from_export(buffer, export_type)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_federation_termination_notification_new_from_export')
        return LogoutRequest(obj)
    new_from_export = classmethod(new_from_export)

class LogoutRequest(LibLogoutRequest):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        LibLogoutRequest.__init__(self, _obj = self._o)
        
    def new(cls, providerID, nameIdentifier, nameQualifier, format):
        obj = lassomod.logout_request_new(providerID, nameIdentifier, nameQualifier, format)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_logout_request_new')
        return LogoutRequest(obj)
    new = classmethod(new)

    def new_from_export(cls, buffer, export_type = 0):
        obj = lassomod.logout_request_new_from_export(buffer, export_type)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_logout_request_new_from_export')
        return LogoutRequest(obj)
    new_from_export = classmethod(new_from_export)


class LogoutResponse(LibLogoutResponse):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        LibLogoutResponse.__init__(self, _obj = self._o)

    def new_from_export(cls, buffer, export_type = 0):
        obj = lassomod.logout_response_new_from_export(buffer, export_type)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_logout_response_new_from_export')
        return LogoutResponse(obj)
    new_from_export = classmethod(new_from_export)

    def new_from_request_export(cls, buffer, export_type, providerID, statusCodeValue):
        obj = lassomod.logout_response_new_from_request_export(
            buffer, export_type, providerID, statusCodeValue)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_logout_response_new_from_request_export')
        return LogoutResponse(obj)
    new_from_export = classmethod(new_from_request_export)


class NameIdentifierMappingRequest(LibNameIdentifierMappingRequest):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        LibNameIdentifierMappingRequest.__init__(self, _obj = self._o)

    def new(cls, providerID, nameIdentifier, nameQualifier, format):
        obj = lassomod.name_identifier_mapping_request_new(
            providerID, nameIdentifier, nameQualifier, format)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_name_identifier_mapping_request_new')
        return NameIdentifierMappingRequest(obj)
    new = classmethod(new)

    def new_from_soap(cls, envelope):
        obj = lassomod.name_identifier_mapping_request_new_from_soap(envelope)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_request_new_from_soap')
        return NameIdentifierMappingRequest(obj)
    new_from_soap = classmethod(new_from_soap)

    def new_from_query(cls, query):
        obj = lassomod.name_identifier_mapping_request_new_from_query(query)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_request_new_from_query')
        return NameIdentifierMappingRequest(obj)
    new_from_query = classmethod(new_from_query)


class NameIdentifierMappingResponse(LibNameIdentifierMappingResponse):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        LibNameIdentifierMappingResponse.__init__(self, _obj = self._o)

    def new_from_dump(cls, dump):
        obj = lassomod.name_identifier_mapping_response_new_from_dump(dump)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_response_new_from_dump')
        return NameIdentifierMappingResponse(obj)
    new_from_dump = classmethod(new_from_dump)

    def new_from_query(cls, query):
        obj = lassomod.name_identifier_mapping_response_new_from_query(query)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_response_new_from_query')
        return NameIdentifierMappingResponse(obj);
    new_from_query = classmethod(new_from_query)

    def new_from_request_query(cls, query, providerID, status_code_value):
        obj = lassomod.name_identifier_mapping_response_new_from_request_query(
            query, providerID, status_code_value)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_response_new_from_request_query')
        return NameIdentifierMappingResponse(obj);
    new_from_request_query = classmethod(new_from_request_query)

    def new_from_request_soap(cls, envelope, providerID, status_code_value):
        obj = lassomod.name_identifier_mapping_response_new_from_request_soap(
            envelope, providerID, status_code_value)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_response_new_from_request_soap')
        return NameIdentifierMappingResponse(obj)
    new_from_request_soap = classmethod(new_from_request_soap)

    def new_from_soap(cls, envelope):
        obj = lassomod.name_identifier_mapping_response_new_from_soap(envelope)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_name_identifier_mapping_response_new_from_soap')
        return NameIdentifierMappingResponse(obj)
    new_from_soap = classmethod(new_from_soap)


class RegisterNameIdentifierRequest(LibRegisterNameIdentifierRequest):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        LibRegisterNameIdentifierRequest.__init__(self, _obj = self._o)

    def new(cls, providerID, idpNameIdentifier, idpNameQualifier, idpFormat,
            spNameIdentifier, spNameQualifier, spFormat,
            oldNameIdentifier, oldNameQualifier, oldFormat):
        obj = lassomod.register_name_identifier_request_new(
            providerID, idpNameIdentifier, idpNameQualifier, idpFormat,
            spNameIdentifier, spNameQualifier, spFormat,
            oldNameIdentifier, oldNameQualifier, oldFormat)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_register_name_identifier_request_new')
        return RegisterNameIdentifierRequest(obj)
    new = classmethod(new)

    def new_from_export(cls, buffer, export_type = 0):
        obj = lassomod.register_name_identifier_request_new_from_export(buffer, export_type)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_register_name_identifier_request_new_from_export')
        return RegisterNameIdentifierRequest(obj)
    new_from_export = classmethod(new_from_export)

    def rename_attributes_for_encoded_query(self):
        lassomod.register_name_identifier_request_rename_attributes_for_query(self)


class RegisterNameIdentifierResponse(LibRegisterNameIdentifierResponse):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        LibRegisterNameIdentifierResponse.__init__(self, _obj = self._o)

    def new_from_export(cls, buffer, export_type = 0):
        obj = lassomod.register_name_identifier_response_new_from_export(buffer, export_type)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_register_name_identifier_response_new_from_export')
        return RegisterNameIdentifierResponse(obj)
    new_from_export = classmethod(new_from_export)

    def new_from_request_export(cls, buffer, export_type, providerID, statusCodeValue):
        obj = lassomod.register_name_identifier_response_new_from_request_export(
            buffer, export_type, providerID, statusCodeValue)
        if obj is None:
            raise ErrorInstanceCreationFailed(
                'lasso_register_name_identifier_response_new_from_request_export')
        return RegisterNameIdentifierResponse(obj)
    new_from_export = classmethod(new_from_request_export)    


################################################################################
# elements
################################################################################


class Assertion(SamlAssertion):
    """\brief Blabla

    Bla bla
    """
    def __init__(self, issuer, requestID, _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.assertion_new(issuer, requestID)
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_assertion_new')
        SamlAssertion.__init__(self, _obj=_obj)


class AuthenticationStatement(Node):
    """\brief Blabla

    Bla bla
    """
    def __init__(self,
                 authenticationMethod,
                 reauthenticateOnOrAfter,
                 nameIdentifier,
                 nameQualifier,
                 format,
                 idp_nameIdentifier,
                 idp_nameQualifier,
                 idp_format,
                 _obj=None):
        """
        The constructor
        """
        if _obj != None:
            self._o = _obj
            return
        _obj = lassomod.authentication_statement_new(authenticationMethod,
                                                     reauthenticateOnOrAfter,
                                                     nameIdentifier,
                                                     nameQualifier,
                                                     format,
                                                     idp_nameIdentifier,
                                                     idp_nameQualifier,
                                                     idp_format)
        if _obj is None:
            raise ErrorInstanceCreationFailed('lasso_authentication_statement_new')
        Node.__init__(self, _obj=_obj)


################################################################################
# environs: high level classes
################################################################################


signatureMethodRsaSha1 = 1
signatureMethodDsaSha1 = 2

httpMethodGet      = 1
httpMethodPost     = 2
httpMethodRedirect = 3
httpMethodSoap     = 4

messageTypeNone          = 0
messageTypeAuthnRequest  = 1
messageTypeAuthnResponse = 2
messageTypeRequest       = 3
messageTypeResponse      = 4
messageTypeArtifact      = 5


class Server:
    """\brief Short desc

    Long desc
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj

    def new(cls, metadata=None, public_key=None, private_key=None,
            certificate=None, signature_method=0):
        obj = lassomod.server_new(metadata, public_key, private_key,
                                  certificate, signature_method)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_server_new')
        return Server(obj)
    new = classmethod(new)

    def new_from_dump(cls, dump):
        obj = lassomod.server_new_from_dump(dump)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_server_new_from_dump')
        return Server(obj)
    new_from_dump = classmethod(new_from_dump)

    def add_provider(self, metadata, public_key=None, certificate=None):
        errorCode = lassomod.server_add_provider(self, metadata, public_key, certificate)
        if errorCode:
            raise newError(errorCode, 'lasso_server_add_provider')

    def dump(self):
        return lassomod.server_dump(self)

    def destroy(self):
        lassomod.server_destroy(self)

class Identity:
    """
    """

    def __init__(self, _obj):
        """
        """
        self._o = _obj

    def new(cls):
        obj = lassmod.identity_new()
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_identity_new')
        return Identity(obj)
    new = classmethod(new)

    def new_from_dump(cls, dump):
        obj = lassomod.identity_new_from_dump(dump)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_identity_new_from_dump')
        return Identity(obj)
    new_from_dump = classmethod(new_from_dump)

    def dump(self):
        return lassomod.identity_dump(self)

class Session:
    """
    """

    def __init__(self, _obj):
        """
        """
        self._o = _obj

    def __isprivate(self, name):
        return name == '_o'

    def __getattr__(self, name):
        if self.__isprivate(name):
            return self.__dict__[name]
        if name[:2] == "__" and name[-2:] == "__" and name != "__members__":
            raise AttributeError, name
        ret = lassomod.session_getattr(self, name)
        if ret is None:
            raise AttributeError, name
        return ret

    def new(cls):
        obj = lassmod.session_new()
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_session_new')
        return Session(obj)
    new = classmethod(new)

    def new_from_dump(cls, dump):
        obj = lassomod.session_new_from_dump(dump)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_session_new_from_dump')
        return Session(obj)
    new_from_dump = classmethod(new_from_dump)

    def add_assertion(self, remote_providerID, assertion):
        lassomod.session_add_assertion(self, remote_providerID, assertion)

    def dump(self):
        return lassomod.session_dump(self)

    def destroy(self):
        lassomod.session_destroy(self)

    def get_assertion(self, remote_providerID):
        return Node(lassomod.session_get_assertion(self, remote_providerID))

    def get_authentication_method(self, remote_providerID = None):
        return lassomod.session_get_authentication_method(self, remote_providerID)

    def get_next_assertion_remote_providerID(self):
        return lassomod.session_get_next_assertion_remote_providerID(self)

    def remove_assertion(self, remote_providerID):
        lassomod.session_remove_assertion(self, remote_providerID)

## Profile
# Request types
requestTypeLogin                  = 1
requestTypeLogout                 = 2
requestTypeFederationTermination  = 3
requestTypeRegisterNameIdentifier = 4
requestTypeNameIdentifierMapping  = 5
requestTypeLecp                   = 6

def get_request_type_from_soap_msg(soap_buffer):
    return lassomod.profile_get_request_type_from_soap_msg(soap_buffer);

class Profile:
    """\brief Short desc

    Long desc
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj

    def new(cls, server, identity=None, session=None):
        obj = lassomod.profile_new(server, identity, session)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_profile_new')
        return Profile(obj)
    new = classmethod(new)

    def get_identity(self):
        obj = lassomod.profile_get_identity(self)
        if obj != None:
            return Identity(_obj=obj)
        else:
            return None

    def get_session(self):
        obj = lassomod.profile_get_session(self)
        if obj != None:
            return Session(_obj=obj)
        else:
            return None
    
    def is_identity_dirty(self):
        return lassomod.profile_is_identity_dirty(self)

    def is_session_dirty(self):
        return lassomod.profile_is_session_dirty(self)

    def set_identity(self, identity):
        errorCode = lassomod.profile_set_identity(self, identity)
        if errorCode:
            raise newError(errorCode, 'lasso_profile_set_identity')

    def set_identity_from_dump(self, dump):
        errorCode = lassomod.profile_set_identity_from_dump(self, dump)
        if errorCode:
            raise newError(errorCode, 'lasso_profile_set_identity_from_dump')

    def set_session(self, session):
        errorCode = lassomod.profile_set_session(self, session)
        if errorCode:
            raise newError(errorCode, 'lasso_profile_set_session')

    def set_session_from_dump(self, dump):
        errorCode = lassomod.profile_set_session_from_dump(self, dump)
        if errorCode:
            raise newError(errorCode, 'lasso_profile_set_session_from_dump')

## login
loginProtocolProfileBrwsArt  = 1
loginProtocolProfileBrwsPost = 2

class Login(Profile):
    """\brief Short desc

    Long desc
    """

    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        Profile.__init__(self, _obj=_obj)
        
    def __isprivate(self, name):
        return name == '_o'

    def __getattr__(self, name):
        if self.__isprivate(name):
            return self.__dict__[name]
        if name[:2] == "__" and name[-2:] == "__" and name != "__members__":
            raise AttributeError, name
        ret = lassomod.login_getattr(self, name)
        if ret is None:
            raise AttributeError, name
        elif name == "request":
            if lassomod.login_getattr(self, "request_type") == messageTypeAuthnRequest:
                ret = AuthnRequest(None, _obj=ret)
            elif lassomod.login_getattr(self, "request_type") == messageTypeRequest:
                ret = Node(_obj=ret)
                # FIXME ret = Request(_obj=ret)
        elif name == "response":
            if lassomod.login_getattr(self, "response_type") == messageTypeAuthnResponse:
                ret = AuthnResponse(None, _obj=ret)
            elif lassomod.login_getattr(self, "response_type") == messageTypeResponse:
                ret = SamlpResponse(_obj=ret)
                # FIXME ret = Response(_obj=ret)
            elif lassomod.login_getattr(self, "response_type") == messageTypeArtifact:
                ret = Node(_obj=ret)
        return ret

    def new(cls, server):
        obj = lassomod.login_new(server)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_login_new')
        return Login(obj)
    new = classmethod(new)

    def new_from_dump(cls, server, dump):
        obj = lassomod.login_new_from_dump(server, dump)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_login_new_from_dump')
        return Login(obj)
    new_from_dump = classmethod(new_from_dump)

    def accept_sso(self):
        errorCode = lassomod.login_accept_sso(self)
        if errorCode:
            raise newError(errorCode, 'lasso_login_accept_sso')

    def build_artifact_msg(self, authentication_result, authenticationMethod,
                           reauthenticateOnOrAfter, method):
        errorCode = lassomod.login_build_artifact_msg(
            self, authentication_result, authenticationMethod, reauthenticateOnOrAfter, method)
        if errorCode:
            raise newError(errorCode, 'lasso_login_build_artifact_msg')

    def build_authn_request_msg(self, remote_providerID):
        errorCode = lassomod.login_build_authn_request_msg(self, remote_providerID)
        if errorCode:
            raise newError(errorCode, 'lasso_login_build_authn_request_msg')

    def build_authn_response_msg(self, authentication_result, authenticationMethod,
                                 reauthenticateOnOrAfter):
        errorCode = lassomod.login_build_authn_response_msg(
            self, authentication_result, authenticationMethod, reauthenticateOnOrAfter)
        if errorCode:
            raise newError(errorCode, 'lasso_login_build_authn_response_msg')

    def build_request_msg(self):
        errorCode = lassomod.login_build_request_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_login_build_request_msg')

    def dump(self):
        return lassomod.login_dump(self)

    def init_authn_request(self):
        errorCode = lassomod.login_init_authn_request(self)
        if errorCode:
            raise newError(errorCode, 'lasso_login_init_authn_request')

    def init_from_authn_request_msg(self, authn_request_msg, authn_request_method):
        errorCode = lassomod.login_init_from_authn_request_msg(
            self, authn_request_msg, authn_request_method)
        if errorCode:
            raise newError(errorCode, 'lasso_login_init_from_authn_request_msg')

    def init_request(self, response_msg, response_method):
        errorCode = lassomod.login_init_request(self, response_msg, response_method)
        if errorCode:
            raise newError(errorCode, 'lasso_login_init_request')

    def must_authenticate(self):
        return lassomod.login_must_authenticate(self)

    def process_authn_response_msg(self, authn_response_msg):
        errorCode = lassomod.login_process_authn_response_msg(self, authn_response_msg)
        if errorCode:
            raise newError(errorCode, 'lasso_login_process_authn_response_msg')

    def process_request_msg(self, request_msg):
        errorCode = lassomod.login_process_request_msg(self, request_msg)
        if errorCode:
            raise newError(errorCode, 'lasso_login_process_request_msg')

    def process_response_msg(self, response_msg):
        errorCode = lassomod.login_process_response_msg(self, response_msg)
        if errorCode:
            raise newError(errorCode, 'lasso_login_process_response_msg')


providerTypeNone = 0
providerTypeSp   = 1
providerTypeIdp  = 2

class Logout(Profile):
    """\brief Short desc

    Long desc
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        Profile.__init__(self, _obj=_obj)

    def __isprivate(self, name):
        return name == '_o'

    def __getattr__(self, name):
        if self.__isprivate(name):
            return self.__dict__[name]
        if name[:2] == "__" and name[-2:] == "__" and name != "__members__":
            raise AttributeError, name
        ret = lassomod.logout_getattr(self, name)
        if ret is None:
            return None
        elif name == "request":
            ret = LogoutRequest(_obj=ret)
        elif name == "response":
            ret = LogoutResponse(_obj=ret)
        return ret

    def new(cls, server, provider_type):
        obj = lassomod.logout_new(server, provider_type)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_logout_new')
        return Logout(obj)
    new = classmethod(new)

    def build_request_msg(self):
        errorCode = lassomod.logout_build_request_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_logout_build_request_msg')

    def build_response_msg(self):
        errorCode = lassomod.logout_build_response_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_logout_build_response_msg')

    def destroy(self):
        lassomod.logout_destroy(self);

    def get_next_providerID(self):
        return lassomod.logout_get_next_providerID(self);

    def init_request(self, remote_providerID = None):
        errorCode = lassomod.logout_init_request(self, remote_providerID);
        if errorCode:
            raise newError(errorCode, 'lasso_logout_init_request')

    def process_request_msg(self, request_msg, request_method):
        errorCode = lassomod.logout_process_request_msg(self, request_msg, request_method);
        if errorCode:
            raise newError(errorCode, 'lasso_logout_process_request_msg')

    def validate_request(self):
        errorCode = lassomod.logout_validate_request(self);
        if errorCode:
            raise newError(errorCode, 'lasso_logout_validate_request')

    def process_response_msg(self, response_msg, response_method):
        errorCode = lassomod.logout_process_response_msg(self, response_msg, response_method);
        if errorCode:
            raise newError(errorCode, 'lasso_logout_process_response_msg')

class FederationTermination(Profile):
    """\brief Short desc

    Long desc
    """
    def __init__(self, _obj):
        """
        The constructor
        """
        self._o = _obj
        Profile.__init__(self, _obj=_obj)

    def __isprivate(self, name):
        return name == '_o'

    def __getattr__(self, name):
        if self.__isprivate(name):
            return self.__dict__[name]
        if name[:2] == "__" and name[-2:] == "__" and name != "__members__":
            raise AttributeError, name
        ret = lassomod.federation_termination_getattr(self, name)
        if ret:
            if name == "identity":
                ret= Identity(_obj=ret)
            elif name == "session":
                ret= Session(_obj=ret)
        return ret

    def new(cls, server, provider_type):
        obj = lassomod.federation_termination_new(server, provider_type)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_federation_termination_new')
        return FederationTermination(obj)
    new = classmethod(new)

    def build_notification_msg(self):
        errorCode = lassomod.federation_termination_build_notification_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_federation_termination_build_notification_msg')

    def destroy(self):
        lassomod.federation_termination_destroy(self)

    def init_notification(self, remote_providerID = None):
        errorCode = lassomod.federation_termination_init_notification(self, remote_providerID)
        if errorCode:
            raise newError(errorCode, 'lasso_federation_termination_init_notification')

    def process_notification_msg(self, notification_msg, notification_method):
        errorCode = lassomod.federation_termination_process_notification_msg(
            self, notification_msg, notification_method)
        if errorCode:
            raise newError(errorCode, 'lasso_federation_termination_load_notification_msg')

    def validate_notification(self):
        errorCode = lassomod.federation_termination_validate_notification(self)
        if errorCode:
            raise newError(errorCode, 'lasso_federation_termination_process_notification')


class RegisterNameIdentifier(Profile):
    """\brief Short desc

    Long desc
    """

    def __isprivate(self, name):
        return name == '_o'

    def __init__(self, _obj):
        """
        The constructor
        """
        Profile.__init__(self, _obj=_obj)

    def __getattr__(self, name):
        if self.__isprivate(name):
            return self.__dict__[name]
        if name[:2] == "__" and name[-2:] == "__" and name != "__members__":
            raise AttributeError, name
        ret = lassomod.register_name_identifier_getattr(self, name)
        return ret

    def new(cls, server, identity, provider_type):
        obj = lassomod.register_name_identifier_new(server, identity, provider_type)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_register_name_identifier_new')
        return RegisterNameIdentifier(obj)
    new = classmethod(new)

    def build_request_msg(self):
        errorCode = lassomod.register_name_identifier_build_request_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_register_name_identifier_build_request_msg')

    def build_response_msg(self):
        errorCode = lassomod.register_name_identifier_build_response_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_register_name_identifier_build_response_msg')

    def destroy(self):
        pass

    def init_request(self, remote_providerID):
        errorCode = lassomod.register_name_identifier_init_request(self, remote_providerID)
        if errorCode:
            raise newError(errorCode, 'lasso_register_name_identifier_init_request')

    def process_request_msg(self):
        errorCode = lassomod.register_name_identifier_process_request_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_register_name_identifier_process_request_msg')

    def process_response_msg(self, response_msg, response_method):
        errorCode = lassomod.register_name_identifier_process_response_msg(
            self, response_msg, response_method)
        if errorCode:
            raise newError(errorCode, 'lasso_register_name_identifier_process_response_msg')

class Lecp(Login):
    """\brief Short desc

    Long desc
    """

    def __isprivate(self, name):
        return name == '_o'

    def __init__(self, _obj):
        """
        The constructor
        """
        Login.__init__(self, _obj = _obj)

    def __getattr__(self, name):
        if self.__isprivate(name):
            return self.__dict__[name]
        if name[:2] == "__" and name[-2:] == "__" and name != "__members__":
            raise AttributeError, name
        ret = lassomod.lecp_getattr(self, name)
        if ret is None:
            raise AttributeError, name
        elif name == "request":
            if lassomod.lecp_getattr(self, "request_type") == messageTypeAuthnRequest:
                ret = AuthnRequest(None, _obj=ret)
            elif lassomod.lecp_getattr(self, "request_type") == messageTypeRequest:
                ret = Node(_obj=ret)
                # FIXME ret = Request(_obj=ret)
        elif name == "response":
            if lassomod.lecp_getattr(self, "response_type") == messageTypeAuthnResponse:
                ret = AuthnResponse(_obj=ret)
            elif lassomod.lecp_getattr(self, "response_type") == messageTypeResponse:
                ret = SamlpResponse(_obj=ret)
                # FIXME ret = Response(_obj=ret)
            elif lassomod.lecp_getattr(self, "response_type") == messageTypeArtifact:
                ret = Node(_obj=ret)
        return ret

    def new(cls, server = None):
        obj = lassomod.lecp_new(server)
        if obj is None:
            raise ErrorInstanceCreationFailed('lasso_lecp_new')
        return Lecp(obj)
    new = classmethod(new)

    def build_authn_request_envelope_msg(self):
        errorCode = lassomod.lecp_build_authn_request_envelope_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_build_authn_request_envelope_msg')

    def build_authn_response_envelope_msg(self, authentication_result,
                                          authenticationMethod,
                                          reauthenticateOnOrAfter):
        errorCode = lassomod.lecp_build_authn_response_envelope_msg(self,
                                                                    authentication_result,
                                                                    authenticationMethod,
                                                                    reauthenticateOnOrAfter)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_build_authn_response_envelope_msg')

    def build_authn_request_msg(self, remote_providerID):
        errorCode = lassomod.lecp_build_authn_request_msg(self, remote_providerID)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_build_authn_request_msg')

    def build_authn_response_msg(self):
        errorCode = lassomod.lecp_build_authn_response_msg(self)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_build_authn_response_msg')

    def destroy(self):
        lassomod.lecp_destroy(self)

    def init_authn_request(self):
        errorCode = lassomod.lecp_init_authn_request(self)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_init_authn_request')

    def init_from_authn_request_msg(self, authn_request_msg, authn_request_method):
        errorCode = lassomod.lecp_init_from_authn_request_msg(
            self, authn_request_msg, authn_request_method)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_init_from_authn_request_msg')

    def process_authn_request_envelope_msg(self, request_msg):
        errorCode = lassomod.lecp_process_authn_request_envelope_msg(self, request_msg)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_process_authn_request_envelope_msg')

    def process_authn_response_envelope_msg(self, response_msg):
        errorCode = lassomod.lecp_process_authn_response_envelope_msg(self, response_msg)
        if errorCode:
            raise newError(errorCode, 'lasso_lecp_process_authn_response_envelope_msg')


if not _initialized:
    init()