This file is indexed.

/usr/include/rampart-1.3.0/saml.h is in librampart-dev 1.3.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef SAML_H
#define SAML_H

#include <axutil_utils.h>
#include <axutil_array_list.h>
#include <axutil_hash.h>
#include <axutil_date_time.h>
#include <axiom.h>
#include <oxs_xml_signature.h>
#include <oxs_sign_ctx.h>
#include <oxs_xml_key_processor.h>
#include <oxs_utility.h>
#include <oxs_transforms_factory.h>
#include <oxs_xml_key_info_builder.h>
#include <oxs_key_mgr.h>
#include <oxs_transform.h>
#include <oxs_x509_cert.h>
#include <openssl_pkey.h>

#ifdef __cplusplus
extern "C"
{
#endif


#define SAML_VERSION_MAX    16
#define SAML_URI_LEN_MAX    2048
#define SAML_ARRAY_LIST_DEF    4

#define SAML_PREFIX							"saml"
#define SAML_NMSP_URI						"urn:oasis:names:tc:SAML:1.0:assertion"
#define SAML_XML_TYPE						"type"
#define SAML_XSI_NS							"http://www.w3.org/2001/XMLSchema-instance"
#define SAML_XSI							"xsi"

#define SAML_MAJORVERSION					"MajorVersion"
#define SAML_MINORVERSION					"MinorVersion"
#define SAML_ASSERTION_ID					"AssertionID"
#define SAML_ISSUER							"Issuer"
#define SAML_ISSUE_INSTANT					"IssueInstant"
#define SAML_STATEMENT						"Statement"
#define SAML_SUBJECT_STATEMENT				"SubjectStatement"
#define SAML_AUTHENTICATION_STATEMENT		"AuthenticationStatement"
#define SAML_AUTHORIZATION_DECISION_STATEMENT "AuthorizationDecisionStatement"
#define SAML_ATTRIBUTE_STATEMENT			"AttributeStatement"
#define SAML_CONDITIONS						"Conditions"
#define SAML_ADVICE							"Advice"
#define SAML_NOT_BEFORE						"NotBefore"
#define SAML_NOT_ON_OR_AFTER                "NotOnOrAfter"
#define SAML_SIGNATURE						"Signature"

#define SAML_EMAIL_ADDRESS					"#emailAddress"
#define SAML_X509_SUBJECT_NAME				"#X509SubjectName"
#define SAML_WINDOWS_DOMAIN_QUALIFIED_NAME  "#WindowsDomainQualifiedName"

#define SAML_NAME_QUALIFIER					"NameQualifier"
#define SAML_FORMAT							"Format"
#define SAML_NAME_IDENTIFIER                "NameIdentifier"
#define SAML_SUBJECT_CONFIRMATION			"SubjectConfirmation"
#define SAML_CONFIRMATION_METHOD            "ConfirmationMethod"
#define SAML_SUBJECT_CONFIRMATION_DATA		"SubjectConfirmationData"
#define SAML_KEY_INFO						"KeyInfo"
#define SAML_SUBJECT						"Subject"

#define SAML_AUDIENCE						"Audience"
#define SAML_AUDIENCE_RESTRICTION_CONDITION_TYPE "AudienceRestrictionConditionType" 
#define SAML_AUDIENCE_RESTRICTION_CONDITION "AudienceRestrictionCondition"

#define SAML_AUTHENTICATION_METHOD			"AuthenticationMethod"
#define SAML_AUTHENTICATION_INSTANT			"AuthenticationInstant"
#define SAML_IP_ADDRESS						"IPAddress" 
#define SAML_DNS_ADDRESS                    "DNSAddress"
#define SAML_SUBJECT_LOCALITY                "SubjectLocality"
#define SAML_AUTHORITY_BINDING				"AuthorityBinding"
#define SAML_AUTHORITY_KIND					"AuthorityKind"
#define SAML_LOCATION						"Location"
#define SAML_BINDING						"Binding"

#define SAML_RESOURCE						"Resource"
#define SAML_DECISION						"Decision"    
#define SAML_ACTION							"Action"
#define SAML_NAMESPACE						"Namespace"
#define SAML_ASSERTION_ID_REFERENCE			"AssertionIDReference" 
#define SAML_ASSERTION						"Assertion"    
#define SAML_ACTION							"Action"
#define SAML_EVIDENCE						"Evidence"

#define SAML_ATTRIBUTE_NAME					"AttributeName"
#define SAML_ATTRIBUTE_NAMESPACE            "AttributeNamespace"
#define SAML_ATTRIBUTE_VALUE                "AttributeValue"
#define SAML_ATTRIBUTE						"Attribute"
#define SAML_ATTRIBUTE_DESIGNATOR			"AttributeDesignator"

#define SAML_SUB_CONFIRMATION_HOLDER_OF_KEY	"urn:oasis:names:tc:SAML:1.0:cm:holder-of-key"
#define SAML_SUB_CONFIRMATION_SENDER_VOUCHES	"urn:oasis:names:tc:SAML:1.0:cm:sender-vouches"
#define SAML_SUB_CONFIRMATION_ARTIFACT		"urn:oasis:names:tc:SAML:1.0:cm:artifact-01"
#define SAML_SUB_CONFIRMATION_BEARER		"urn:oasis:names:tc:SAML:1.0:cm:bearer"

#define SAML_AUTH_METHOD_URI_PASSWORD		"urn:oasis:names:tc:SAML:1.0:am:password"
#define SAML_AUTH_METHOD_URI_KERBEROS		"urn:ietf:rfc:1510"
#define SAML_AUTH_METHOD_URI_SRP			"urn:ietf:rfc:2945"
#define SAML_AUTH_METHOD_URI_HARDWARE_TOKEN	"urn:oasis:names:tc:SAML:1.0:am:HardwareToken"
#define SAML_AUTH_METHOD_URI_SSL_TLS		"urn:ietf:rfc:2246"
#define SAML_AUTH_METHOD_URI_X509			"urn:oasis:names:tc:SAML:1.0:am:X509-PKI"
#define SAML_AUTH_METHOD_URI_PGP			"urn:oasis:names:tc:SAML:1.0:am:PGP"
#define SAML_AUTH_METHOD_URI_SPKI			"urn:oasis:names:tc:SAML:1.0:am:SPKI"
#define SAML_AUTH_METHOD_URI_XKMS			"urn:oasis:names:tc:SAML:1.0:am:XKMS"
#define SAML_AUTH_METHOD_URI_XML_DS			"urn:ietf:rfc:3075"
#define SAML_AUTH_METHOD_URI_UNSPECIFIED	"urn:oasis:names:tc:SAML:1.0:am:unspecified"

#define SAML_ACTION_URI_RWEDC_N				"urn:oasis:names:tc:SAML:1.0:action:rwedc-negation"
#define SAML_ACTION_URI_RWEDC				"urn:oasis:names:tc:SAML:1.0:action:rwedc"

#define SAML_ACTION_READ					"Read"
#define SAML_ACTION_WRITE					"Write"
#define SAML_ACTION_EXECUTE					"Execute"
#define SAML_ACTION_DELETE					"Delete"
#define SAML_ACTION_CONTROL					"Control"
#define SAML_ACTION_READ_N					"~Read"
#define SAML_ACTION_WRITE_N					"~Write"
#define SAML_ACTION_EXECUTE_N				"~Execute"
#define SAML_ACTION_DELETE_N				"~Delete"
#define SAML_ACTION_CONTROL_N				"~Control"

#define SAML_MAJOR_VERSION					"1"

typedef struct saml_assertion_s saml_assertion_t;

#ifndef SAML_DECLARE
#define SAML_DECLARE(type)	AXIS2_EXTERN type AXIS2_CALL
#endif

/* Defines the possible values to be reported as the status of an
 * authorization decision statement.
 */
typedef enum decision_type
{
    PERMIT = 0,
    DENY,
    INDETERMINATE
} decision_type_t;

typedef enum
{
    SAML_COND_UNSPECFIED = 0,
    SAML_COND_AUDI_RESTRICTION 
} saml_cond_type_t; 

typedef struct condition_s 
{
    saml_cond_type_t type;
    void *cond;
} saml_condition_t;

typedef struct saml_audi_restriction_cond_s
{
    axutil_array_list_t *audiences;	
} saml_audi_restriction_cond_t;

typedef struct saml_advise_s
{
    int a;
} saml_advise_t;

typedef enum
{
    SAML_STMT_UNSPECIFED = 0,
    SAML_STMT_SUBJECTSTATEMENT,
    SAML_STMT_AUTHENTICATIONSTATEMENT,
    SAML_STMT_AUTHORIZATIONDECISIONSTATEMENT,
    SAML_STMT_ATTRIBUTESTATEMENT
} saml_stmt_type_t;

typedef struct
{
    saml_stmt_type_t type;
    void *stmt;
} saml_stmt_t;

typedef struct saml_named_id_s
{
    /* The security or administrative domain that qualifies the name of 
     * the subject 
     */
    axis2_char_t *name_qualifier;

    /* The syntax used to describe the name of the subject */
    axis2_char_t *format;

    axis2_char_t *name;
} saml_named_id_t;


typedef struct saml_subject_s
{
    saml_named_id_t *named_id;
    
    /* URI reference that identifies a protocol to be used to authenticate 
     * the subject 
     */
    axutil_array_list_t *confirmation_methods;

    /* An XML Signature element that specifies a cryptographic key held by 
     * the subject 
     */
    axiom_node_t *key_info;

    /* Additional authentication information to be used by a specific 
     * authentication protocol 
     */
    axiom_node_t *confirmation_data;    
} saml_subject_t;

typedef struct saml_subject_stmt_s
{
    saml_subject_t *subject;
} saml_subject_stmt_t;

typedef struct saml_action
{
    /* URI for the specified action to be performed */
    char *name_space;

    /* An action to be performed on the data */
    char *data;
} saml_action_t;


typedef struct saml_evidence_s
{
    /* Specifies an assertion by reference to the value of the assertion�s 
     * AssertionID attribute 
     */
    axutil_array_list_t *assertion_ids;

    /* Specifies an assertion by value */
    axutil_array_list_t *assertions;
} saml_evidence_t;


typedef struct saml_subject_locality
{
    /* The IP address of the system entity that was authenticated */
    axis2_char_t *ip;

    /* The DNS address of the system entity that was authenticated */
    axis2_char_t *dns;
} saml_subject_locality_t;


typedef struct saml_auth_binding
{
    /* The type of SAML Protocol queries to which the authority described 
     * by this element will respond 
     */
    axis2_char_t *auth_kind;

    /* A URI reference describing how to locate and communicate with the 
     * authority 
     */
    axis2_char_t *location;

    /* A URI reference identifying the SAML protocol binding to use 
     * in communicating with the authority 
     */
    axis2_char_t *binding;
} saml_auth_binding_t;

typedef struct saml_auth_stmt
{
	saml_subject_t *subject;

    /* A URI reference that specifies the type of authentication that took place */
    axis2_char_t *auth_method;
    
    /* Specifies the time at which the authentication took place */
    axutil_date_time_t *auth_instanse;

    /* 
     * Specifies the DNS domain name and IP address for the system entity from which the Subject was
     * apparently authenticated 
     */
    /*saml_subject_locality_t *sub_locality;*/
	axis2_char_t *ip;
	
	axis2_char_t *dns;

    /* Indicates that additional information about the subject of the statement may be available */
    axutil_array_list_t *auth_binding;

} saml_auth_stmt_t;

typedef struct saml_auth_desicion_stmt
{
    saml_subject_t *subject;
    /* A URI reference identifying the resource to which access authorization */
    char *resource;

    /* The decision rendered by the issuer with respect to the specified resource */
    char *decision;

    /* The set of actions authorized to be performed on the specified resource */
    axutil_array_list_t *action;

    /* A set of assertions that the issuer relied on in making the decision */
    saml_evidence_t *evidence;
} saml_auth_desicion_stmt_t;

typedef struct saml_attr_s 
{
    /* The name of the attribute */
    char *attr_name;

    /* The namespace in which the AttributeName elements are interpreted */
    char *attr_nmsp;

    axutil_array_list_t *attr_value;
} saml_attr_t;


typedef struct saml_attr_stmt_s 
{
    saml_subject_t *subject;
    /* An attribute */
    axutil_array_list_t *attribute;
} saml_attr_stmt_t;

typedef struct saml_attr_desig_s
{
    axis2_char_t *attr_name;
    axis2_char_t *attr_nmsp;
} saml_attr_desig_t;

struct saml_assertion_s
{
    /* majod version */
    axis2_char_t *major_version;

    /* minor version */
    axis2_char_t *minor_version;

    /* id */
    axis2_char_t *assertion_id;

    /* uri representing the issuer */
    axis2_char_t *issuer;

    /* time instant of the issue */
    axutil_date_time_t *issue_instant;
	
	/* specifies the time instant at which the validity interval begins */
    axutil_date_time_t *not_before;    

	/* specifies the time instant at which the validity interval has ended */
    axutil_date_time_t *not_on_or_after;

    /* SAML condition */
    axutil_array_list_t *conditions;

    /* An XML Signature that authenticates the assertion */
    axiom_node_t *signature;

	/* array list containing the statements */
	axutil_array_list_t *statements;

	/* information about the signing */
	oxs_sign_ctx_t *sign_ctx;

	/* The xml node which is used to build the assertion */
	axiom_node_t *ori_xml;	
};

/* assertion */

/* 
 * Creates a saml assertion.
 * @param env pointer to environment struct
 */
AXIS2_EXTERN saml_assertion_t *AXIS2_CALL 
saml_assertion_create(
	const axutil_env_t *env);

/* 
 * Free a saml assertion
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_assertion_free(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Build the saml assertion from a axiom node.
 * @param assertion assertion to be populated
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_build(
	saml_assertion_t *a, 
	axiom_node_t *node, 
	const axutil_env_t *env);

/* 
 * Serialize a saml assertion to a om node.
 * @param assertion assertion to be serialized
 * @param parent if specified created node will be a child of this  
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_assertion_to_om(
	saml_assertion_t *assertion, 
	axiom_node_t *parent, 
	const axutil_env_t *env);

/* 
 * Returns all the condition in the assertion.
 * @param assertion assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_assetion_get_conditions(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Returns all the statements in the assertion.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_assertion_get_statements(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Set the conditions for the assertion. If there are conditions already 
 * specified, they will be freed. 
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param list array list containing the conditions
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_conditions(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, axutil_array_list_t *list);

/* 
 * Add a condition to the assertin.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param cond a pointer to a condition to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_add_condition(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	saml_condition_t *cond);

/*
 * Remove a condition from the assertion.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_remove_condition(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	int index);

/* 
 * Set the statements for the assertion. If there are statements already 
 * specified, they will be freed. 
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param list array list containing the statements
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_statements(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	axutil_array_list_t *list);

/* 
 * Add a statement to the assertin.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param cond a pointer to a statement to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_add_statement(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	saml_stmt_t *stmt);

/*
 * Remove a statement from the assertion.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_remove_statement(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	int index);

/* 
 * Set the minor vertion of the assertion
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param version minor version number
 */ 
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_minor_version(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	int version);

/* 
 * Set the minor vertion of the assertion
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */ 
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_issuer(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	axis2_char_t *issuer);

/* 
 * Set the issuer of the assertion
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @instant time of the saml issue
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_issue_instant(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	axutil_date_time_t *instant);

/* 
 * Specifies the time instant at which the validity interval begins.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @instant time at which validity interval begins 
 */ 
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_not_before(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	axutil_date_time_t *time);

/* 
 * Specifies the time instant at which the validity interval has ended
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @instant time at which validity interval has ended 
 */ 
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_not_on_or_after(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	axutil_date_time_t *time);

/* 
 * Return SAML authority that created the assertion. The name of the issuer 
 * is provided as a string and it is unambiguous to the relying party.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_assertion_get_issuer(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/*
 * Return the time instant of issue.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL 
saml_assertion_get_issue_instant(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Get the time instant at which the validity interval begins.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */ 
AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL 
saml_assertion_get_not_before(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Get the time instant at which the validity interval has ended
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */ 
AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL 
saml_assertion_get_not_on_or_after(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* sign methods */

/* 
 * Get weather a assertion is signed. This is set when the Assertion is built 
 * from a om node.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @return AXIS2_TRUE if signed.
 */
AXIS2_EXTERN int AXIS2_CALL
saml_assertion_is_signed(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/*
 * Get weather a assertion is set to be signed. This applies when building 
 * the SAML object programmatically.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @return AXIS2_TRUE if the object model is set to be signed.
 */
AXIS2_EXTERN int AXIS2_CALL
saml_assertion_is_sign_set(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/*
 * Verify the assertion according to the sign context set in the 
 * saml_assertion_set_default_signature or saml_assertion_set_signature method.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL
saml_assertion_signature_verify(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Sign the assertion using the information set in the 
 * saml_assertion_set_default_signature or saml_assertion_set_signature method.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL
saml_assertion_sign(
	saml_assertion_t *assertion, 
	axiom_node_t *node, 
	const axutil_env_t *env);

/* 
 * Remove the information set for signing or verifying the assertion.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_unsign(
	saml_assertion_t *assertion, 
	const axutil_env_t *env);

/* 
 * Set the information required to sign the message. 
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param sign_ctx oxs_sign_ctx_t object which contains the sign information
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_default_signature(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	oxs_sign_ctx_t *sign_ctx);

/* 
 * Set the information required to sign the message.
 * @param assertion SAML assertion object
 * @param env pointer to environment struct
 * @param sign_ctx oxs_sign_ctx_t object which contains the sign information
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_assertion_set_signature(
	saml_assertion_t *assertion, 
	const axutil_env_t *env, 
	oxs_sign_ctx_t *sign_ctx);


/* statement */

/* 
 * Create a saml statement. Statement is a generic object which can hold 
 * tatement object can hold other statements like Autherization statements.
 * @param env pointer to environment struct 
 * @return saml_stmt object to hold other staments
 */
AXIS2_EXTERN saml_stmt_t * AXIS2_CALL 
saml_stmt_create(
	const axutil_env_t *env);

/* 
 * Free a saml statment. 
 * @param stmt SAML stmt object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_stmt_free(
	saml_stmt_t *stmt, 
	const axutil_env_t *env);

/* 
 * Build a saml statement from a XML node. The statement types that are 
 * supported are Authentication Statement, Attribute Statement, 
 * Authentication Dicision Statement.
 * @param stmt SAML stmt object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_stmt_build(
	saml_stmt_t *stmt, 
	axiom_node_t *node, 
	const axutil_env_t *env);

/*
 * Serialize a statement to a axiom node.
 * @param stmt SAML stmt object
 * @param parent if specified created node will be a child of this  
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_stmt_to_om(saml_stmt_t *stmt, axiom_node_t *parent, const axutil_env_t *env);

/*
 * Get the type of the statement. 
 * @param stmt SAML stmt object
 * @param env pointer to environment struct
 * @return statment type as saml_stmt_type_t
 */
AXIS2_EXTERN saml_stmt_type_t AXIS2_CALL 
saml_stmt_get_type(saml_stmt_t *stmt, const axutil_env_t *env);

/*
 * Return the specific stament in this statement. 
 * @param stmt SAML stmt object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN saml_stmt_t * AXIS2_CALL 
saml_stmt_get_stmt(saml_stmt_t *stmt, const axutil_env_t *env);

/* 
 * Set the type of statement.
 * @param stmt SAML stmt object
 * @param env pointer to environment struct
 * @param type type of the statement as saml_stmt_type_t 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_stmt_set_type(saml_stmt_t *stmt, const axutil_env_t *env, saml_stmt_type_t type);

/*
 * Set the statement. If a statment is already specified it will be freed.
 * @param stmt SAML stmt object
 * @param env pointer to environment struct
 * @param st pointer to the statement to be set
 * @param type type of the statement as saml_stmt_type_t 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_stmt_set_stmt(saml_stmt_t *stmt, const axutil_env_t *env, 
				   void *st, saml_stmt_type_t type);


/*AXIS2_EXTERN int AXIS2_CALL saml_id_init(saml_id_t *id, const axutil_env_t *env);*/
AXIS2_EXTERN axis2_char_t * AXIS2_CALL saml_id_generate_random_bytes(const axutil_env_t *env);
/*AXIS2_EXTERN void AXIS2_CALL saml_id_uninit(saml_id_t *id, const axutil_env_t *env);*/


/* AuthorityBinding */

/*
 * Creates a SAML AuthorityBinding.
 * @param env pointer to environment struct
 */
AXIS2_EXTERN saml_auth_binding_t * AXIS2_CALL 
saml_auth_binding_create(const axutil_env_t *env);

/*
 * Free a SAML Autherity binding.
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_auth_binding_free(saml_auth_binding_t *auth_bind, const axutil_env_t *env);

/*
 * Create a SAML autherity binding from a XML node.
 * @param auth_bind SAML Autherity binding object
 * @param node XML node containing the autherity binding 
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_binding_build(saml_auth_binding_t *auth_bind, 
						axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize an auth binding to axiom node
 * @param auth_bind SAML Autherity binding object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_auth_binding_to_om(saml_auth_binding_t *auth_binding, 
						axiom_node_t *parent, const axutil_env_t *env);

/*
 * Return the type of SAML protocol queries to which the authority described 
 * by this element will respond.
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_binding_get_authoity_kind(saml_auth_binding_t *auth_bind, 
									const axutil_env_t *env);

/*
 * Return the URI identifying the SAML protocol binding to use in 
 * communicating with the authority.
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_binding_get_binding(saml_auth_binding_t *auth_binding, 
							  const axutil_env_t *env);

/*
 * Return a URI describing how to locate and communicate with the authority
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_binding_get_location(saml_auth_binding_t *auth_bind, 
							   const axutil_env_t *env);

/*
 * Set the type of SAML protocol queries to which the authority described 
 * by this element will respond.
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct 
 * @param auth_kind A string representing the SAML protocol queries 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_binding_set_authority_kind(saml_auth_binding_t *auth_bind, 
									 const axutil_env_t *env, axis2_char_t *auth_kind);

/*
 * Set the URI identifying the SAML protocol binding to use in 
 * communicating with the authority.
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct 
 * @param binding URI identifying the SAML protocol binding 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_binding_set_binding(saml_auth_binding_t *auth_bind, 
							  const axutil_env_t *env, axis2_char_t *binding);

/*
 * Set a URI describing how to locate and communicate with the authority
 * @param auth_bind SAML Autherity binding object
 * @param env pointer to environment struct 
 * @param location URI describing location and communication protocol
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_binding_set_location(saml_auth_binding_t *auth_bind, 
							   const axutil_env_t *env, axis2_char_t *location);


/* subject locality */

/*
 * Create a SAML subject locality.
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN saml_subject_locality_t * AXIS2_CALL 
saml_subject_locality_create(const axutil_env_t *env);

/*
 * Free a SAML subject locality.
 * @param sub_locality SAML subject locality object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_subject_locality_free(saml_subject_locality_t *sub_locality, 
						   const axutil_env_t *env);

/*
 * Populate a SAML subject locality from a XML node containing a SAML 
 * subject locality.
 * @param sub_locality SAML subject locality object
 * @param node XML node containing the SAML subject locality
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_locality_build(saml_subject_locality_t *sub_locality, 
							axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize a subject locality to an axiom node.
 * @param sub_locality SAML subject locality object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t *AXIS2_CALL 
saml_subject_locality_to_om(saml_subject_locality_t *sub_locality, 
							axiom_node_t *parent, const axutil_env_t *env);

/*
 * Return the IP address of the system entity that was authenticated.
 * @param sub_locality SAML subject locality object
 * @param env pointer to environment struct 
 * @return IP address
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_subject_locality_get_ip(saml_subject_locality_t *sub_locality, 
							 const axutil_env_t *env);

/*
 * Return the DNS address of the system entity that was authenticated.
 * @param sub_locality SAML subject locality object
 * @param env pointer to environment struct 
 * @return DNS address
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_subject_locality_get_dns(saml_subject_locality_t *sub_locality, 
							  const axutil_env_t *env);

/*
 * Set the IP address of the system entity that was authenticated.
 * @param sub_locality SAML subject locality object
 * @param env pointer to environment struct 
 * @param ip IP address
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_locality_set_ip(saml_subject_locality_t *sub_locality, 
							 const axutil_env_t *env, axis2_char_t *ip);

/*
 * Set the DNS address of the system entity that was authenticated.
 * @param sub_locality SAML subject locality object
 * @param env pointer to environment struct 
 * @param ip DNS address
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_locality_set_dns(saml_subject_locality_t *sub_locality, 
							  const axutil_env_t *env, axis2_char_t *dns);


/* subject */

/*
 * Create a SAML subject
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN saml_subject_t * AXIS2_CALL 
saml_subject_create(const axutil_env_t *env);

/*
 * Free a SAML subject
 * @param subject SAML subject object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_subject_free(saml_subject_t *subject, const axutil_env_t *env);

/*
 * Populates a SAML subject from a XML node containing a SAML subject.
 * @param subject SAML subject object
 * @param node XML node containing the SAML subject locality
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_build(saml_subject_t *subject, 
				   axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize a SAML subject to a axiom node.
 * @param subject SAML subject object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_subject_to_om(saml_subject_t *subject, 
				   axiom_node_t *parent, const axutil_env_t *env);

/*
 * Return the named id of the subject.
 * @param subject SAML subject object
 * @param env pointer to environment struct 
 * @return named id object
 */
AXIS2_EXTERN saml_named_id_t * AXIS2_CALL 
saml_subject_get_named_id(saml_subject_t *subject, const axutil_env_t *env);

/*
 * Return the list of confirmation methods. Array list contains string values.
 * @param subject SAML subject object
 * @param env pointer to environment struct 
 * @return list containing the subject confirmation methods
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_subject_get_confirmation_methods(saml_subject_t *subject, 
									  const axutil_env_t *env);

/*
 * Return the list of confirmation data. Array list contains string values.
 * @param subject SAML subject object
 * @param env pointer to environment struct 
 * @return list containing the subject confirmation data
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_subject_get_confirmation_data(saml_subject_t *subject, const axutil_env_t *env);

/*
 * Return an axiom node containing the key info of this subject. The axiom node 
 * is a ds:keyinfo of XML signature. 
 * @param subject SAML subject object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_subject_get_key_info(saml_subject_t *subject, const axutil_env_t *env);

/*
 * Set the named id of the subject.
 * @param subject SAML subject object
 * @param env pointer to environment struct  
 * @param named_id a named id to be set
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_set_named_id(saml_subject_t *subject, 
						  const axutil_env_t *env, saml_named_id_t *named_id);

/*
 * Set the confirmation as a array list. The array list should contain 
 * string values. If confirmation methods are already present they will 
 * be freed.
 * @param subject SAML subject object
 * @param env pointer to environment struct  
 * @param list list of confirmation methods
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_set_confirmation_methods(saml_subject_t *subject, 
									  const axutil_env_t *env, 
									  axutil_array_list_t *list);
/* 
 * Add a subject confirmation to this subject.
 * @param subject SAML subject object
 * @param env pointer to environment struct
 * @param sub_confirmation subject confirmation
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_add_confirmation(saml_subject_t *subject, 
							  const axutil_env_t *env, 
							  axis2_char_t *sub_confirmation);

/* 
 * Remove a subject confirmatin at the specified index.
 * @param subject SAML subject object
 * @param env pointer to environment struct
 * @param index index of the subject confirmation
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_remove_subject_confiirmation(saml_subject_t *subject, 
										  const axutil_env_t *env, int index);

/* 
 * Set an XML Signature keyinfo element that provides access to a cryptographic 
 * key held by the subject
 * @param subject SAML subject object
 * @param env pointer to environment struct
 * @param node XML signature keyinfo element
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_set_key_info(saml_subject_t *subject, 
						  const axutil_env_t *env, axiom_node_t *node);

/* subject statement */

/*
 * Builds a subject statement from a om node containing a subject statement.
 * @param subject_stmt a subject statement object
 * @param node om node containing a subject statement
 * @param env pointer to environment struct
 */ 
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_stmt_build(saml_subject_stmt_t *subject_stmt, 
						axiom_node_t *node, const axutil_env_t *env);

/* 
 * Free a subject statement object
 * @param subject_stmt a subject statement object 
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_subject_stmt_free(saml_subject_stmt_t *subject_stmt, 
					   const axutil_env_t *env);

/* 
 * Create a subject statment object
 * @param env pointer to environment struct
 * @return a subject statement object
 */
AXIS2_EXTERN saml_subject_stmt_t * AXIS2_CALL 
saml_subject_stmt_create(const axutil_env_t *env);

/*
 * Serialize a subject statment to an axiom node
 * @param subject_stmt a subject statement object 
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_subject_stmt_to_om(saml_subject_stmt_t *subject_stmt, 
						axiom_node_t *parent, const axutil_env_t *env);

/* 
 * Set the subject of the subject statement
 * @param subject_stmt a subject statement object 
 * @param env pointer to environment struct 
 * @param subject subject to be set
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_subject_stmt_set_subject(saml_subject_stmt_t *subject_stmt, 
							  const axutil_env_t *env, saml_subject_t *subject);

/*
 * Set the subject of the subject statement
 * @param subject_stmt a subject statement object 
 * @param env pointer to environment struct 
 * @param subject subject to be set
 */
AXIS2_EXTERN saml_subject_t * AXIS2_CALL 
saml_subject_stmt_get_subject(saml_subject_stmt_t *subject_stmt, 
							  const axutil_env_t *env);

/* auth desicin statement */
/*
 * Create an autherization decision statement object.
 * @param env pointer to environment struct 
 * @return an autherization decision statement object
 */
AXIS2_EXTERN saml_auth_desicion_stmt_t * AXIS2_CALL 
saml_auth_desicion_stmt_create(const axutil_env_t *env);

/*
 * Free an autherization decision statement object.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_auth_desicion_stmt_free(saml_auth_desicion_stmt_t *auth_des_stmt, 
							 const axutil_env_t *env);

/*
 * Populates an saml_auth_desicion_stmt_t object from a XML node containing
 * autherization decision statement.
 * @param auth_des_stmt a autherization decision statement object
 * @param node xml node containing autherization decision object.
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_build(saml_auth_desicion_stmt_t *auth_des_stmt, 
							  axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize an saml_auth_desicion_stmt_t object to a axiom node.
 * @param auth_des_stmt a autherization decision statement object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_auth_desicion_stmt_to_om(saml_auth_desicion_stmt_t *auth_des_stmt, 
							  axiom_node_t *parent, const axutil_env_t *env);

/*
 * Get the subject which is in this autheization decision statement.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN saml_subject_t * AXIS2_CALL 
saml_auth_desicion_stmt_get_subject(saml_auth_desicion_stmt_t *auth_des_stmt, 
									const axutil_env_t *env);
/*
 * Return a URI reference identifying the resource to which access 
 * authorization is sought.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_desicion_stmt_get_resource(saml_auth_desicion_stmt_t *auth_des_stmt, 
									 const axutil_env_t *env);

/*
 * Return the decision rendered by the SAML authority with respect to 
 * the specified resource. 
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_desicion_stmt_get_desicion(saml_auth_desicion_stmt_t *auth_des_stmt, 
									 const axutil_env_t *env);

/* 
 * Return the list of actions authorized to be performed on the specified 
 * resource.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_auth_desicion_stmt_get_actions(saml_auth_desicion_stmt_t *auth_des_stmt, 
									const axutil_env_t *env);

/*
 * Return the list of assertions that the SAML authority relied on in making 
 * the decision.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN saml_evidence_t * AXIS2_CALL 
saml_auth_desicion_stmt_get_evidence(saml_auth_desicion_stmt_t *auth_des_stmt, 
									 const axutil_env_t *env);

/*
 * Set a URI reference identifying the resource to which access 
 * authorization is sought.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 * @param resource a URI referencing the resource
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_set_resource(saml_auth_desicion_stmt_t *auth_des_stmt, 
									 const axutil_env_t *env, axis2_char_t *resource);

/*
 * Set the decision rendered by the SAML authority with respect to 
 * the specified resource as a string value. Valid decisions are Permit, 
 * Deny and Indeterminate.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 * @param decision set the decision.
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_set_desicion(saml_auth_desicion_stmt_t *auth_des_stmt, 
									 const axutil_env_t *env, axis2_char_t *desicion);

/* 
 * Set the list of actions authorized to be performed on the specified 
 * resource.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 * @param list list containing action objects
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_set_actions(saml_auth_desicion_stmt_t *auth_des_stmt, 
									const axutil_env_t *env, axutil_array_list_t *list);

/*
 * Remove an action in the specified index.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_remove_action(saml_auth_desicion_stmt_t *auth_des_stmt, 
									  const axutil_env_t *env, int index);

/*
 * Add an action.
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 * @param action action object to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_add_action(saml_auth_desicion_stmt_t *auth_des_stmt, 
								   const axutil_env_t *env, saml_action_t *action);

/*
 * Set the subject of the autherization decision object
 * @param auth_des_stmt a autherization decision statement object
 * @param env pointer to environment struct 
 * @param subject subject to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_desicion_stmt_set_subject(saml_auth_desicion_stmt_t *auth_des_stmt, 
									const axutil_env_t *env, saml_subject_t *subject);

/* auth statement */

/*
 * Create an autherization statement.
 * @param env pointer to environment struct 
 * @return autherization statement object
 */ 
AXIS2_EXTERN saml_auth_stmt_t * AXIS2_CALL 
saml_auth_stmt_create(const axutil_env_t *env);

/*
 * Free a autherization statement.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_auth_stmt_free(saml_auth_stmt_t *auth_stmt, const axutil_env_t *env);

/*
 * Populates an auth_stmt from a om node containing a autherization statement
 * @param auth_stmt autherization statment object
 * @param node an om node containing an autherization statement
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_build(saml_auth_stmt_t *auth_stmt, 
					 axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize an autherization statement to an om node
 * @param auth_stmt autherization statment object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t *AXIS2_CALL 
saml_auth_stmt_to_om(saml_auth_stmt_t *auth_stmt, 
					 axiom_node_t *parent, const axutil_env_t *env);

/*
 * Return a URI reference that specifies the type of authentication that 
 * took place.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @return URI reference 
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_stmt_get_auth_method(saml_auth_stmt_t *auth_stmt, 
							   const axutil_env_t *env);

/*
 * Return the time at which the authentication took place.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @return time at which authentication took place 
 */
AXIS2_EXTERN axutil_date_time_t * AXIS2_CALL 
saml_auth_stmt_get_auth_instant(saml_auth_stmt_t *auth_stmt, 
								const axutil_env_t *env);

/*
 * Return a list of additional information about the subject of 
 * the statement that may be available.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @return a list of autherization binings
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_auth_stmt_get_auth_bindings(saml_auth_stmt_t *auth_stmt, 
								 const axutil_env_t *env);

/*
 * Return the IP address of the system entity that was authenticated.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @return an IP address
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_stmt_get_subject_ip(saml_auth_stmt_t *auth_stmt, 
							  const axutil_env_t *env);
/*
 * Return the DNS address of the system entity that was authenticated.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @return an DNS address
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_auth_stmt_get_subject_dns(saml_auth_stmt_t *auth_stmt, 
							   const axutil_env_t *env);

/* 
 * Set the subject of the autherization statement
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param subject a subject to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_set_subject(saml_auth_stmt_t *auth_stmt, 
						   const axutil_env_t *env, saml_subject_t *subject);

/*
 * Set a URI reference that specifies the type of authentication that 
 * took place.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param method URI reference 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_set_auth_method(saml_auth_stmt_t *auth_stmt, 
							   const axutil_env_t *env, axis2_char_t *method);

/*
 * Set the time at which the authentication took place.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param dt time at which authentication took place 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_set_auth_instant(saml_auth_stmt_t *auth_stmt, 
								const axutil_env_t *env, axutil_date_time_t *dt);

/*
 * Set a list of additional information about the subject of 
 * the statement that may be available as auth_bindings.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param list a list of autherization binings
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_set_auth_bindings(saml_auth_stmt_t *auth_stmt, 
								 const axutil_env_t *env, axutil_array_list_t *list);

/*
 * Add a additional information about the subject of 
 * the statement that may be available as an auth_binding.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param bind an authority binding
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_add_auth_binding(saml_auth_stmt_t *auth_stmt, 
								const axutil_env_t *env, saml_auth_binding_t *bind);

/*
 * Remove an authority binding from a auth_statement.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param index index of the authority binding to be removed
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_remove_auth_binding(saml_auth_stmt_t *auth_stmt, 
								   const axutil_env_t *env, int index);

/*
 * Set the DNS address of the system entity that was authenticated.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param dns a DNS address
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_set_subject_dns(saml_auth_stmt_t *auth_stmt, 
							   const axutil_env_t *env, axis2_char_t *dns);

/*
 * Set the IP address of the system entity that was authenticated.
 * @param auth_stmt autherization statment object
 * @param env pointer to environment struct
 * @param ip an IP address
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_auth_stmt_set_subject_ip(saml_auth_stmt_t *auth_stmt, 
							  const axutil_env_t *env, axis2_char_t *ip);

/* attribute statement */

/*
 * Create a attribute statement.
 * @param env pointer to environment struct
 * @return saml attribute object
 */
AXIS2_EXTERN saml_attr_stmt_t * AXIS2_CALL 
saml_attr_stmt_create(const axutil_env_t *env);

/*
 * Free an attribute statement.
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_attr_stmt_free(saml_attr_stmt_t *attr_stmt, const axutil_env_t *env);

/* 
 * Populates a attribute statement object from a axiom node containing a 
 * attribute statement.
 * @param attr_stmt pointer to an attribute statement object
 * @param node om node containing a attribute statement
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_stmt_build(saml_attr_stmt_t *attr_stmt, 
					 axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize an saml_attr_stmt to an om node
 * @param attr_stmt pointer to an attribute statement object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_attr_stmt_to_om(saml_attr_stmt_t *attr_stmt, 
					 axiom_node_t *parent, const axutil_env_t *env);

/*
 * Get the saml subject in this attribute statement.
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 * @return saml subject
 */
AXIS2_EXTERN saml_subject_t * AXIS2_CALL 
saml_attr_stmt_get_subject(saml_attr_stmt_t *attr_stmt, const axutil_env_t *env);

/*
 * Get the list of attributes in this attribute statement.
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 * @return array list containing the attribute objects
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_attr_stmt_get_attributes(saml_attr_stmt_t *attr_stmt, const axutil_env_t *env);

/*
 * Set the subject of this attribute statement
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 * @param subject 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_stmt_set_subject(saml_attr_stmt_t *attr_stmt, 
						   const axutil_env_t *env, saml_subject_t *subject);

/*
 * Set the attributes of the attribute statement as a list. If the attribute 
 * statement already contains attributes they will be replaced.
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 * @param list attribute list
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_stmt_set_attributes(saml_attr_stmt_t *attr_stmt, 
							  const axutil_env_t *env, axutil_array_list_t *list);

/*
 * Add an attribute to the attribute statement       
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 * @param attribute an attribute to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_stmt_add_attribute(saml_attr_stmt_t *attr_stmt, 
							 const axutil_env_t *env, saml_attr_t *attribute);

/* 
 * Remove an attribute at the given index.
 * @param attr_stmt pointer to an attribute statement object
 * @param env pointer to environment struct
 * @param index index of the attribute
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_stmt_remove_attribute(saml_attr_stmt_t *attr_stmt, 
								const axutil_env_t *env, int index);

/* condition */

/*
 * Create a generic condition. Condition objects holds more specific 
 * conditions. The type attribute of a condition determines the specific 
 * condition.
 * @param env pointer to environment struct
 */
AXIS2_EXTERN saml_condition_t * AXIS2_CALL 
saml_condition_create(const axutil_env_t *env);

/*
 * Free a condition object. The specific condition which is in this conditions 
 * will also be freed.
 * @param cond pointer to a condition object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_condition_free(saml_condition_t *cond, const axutil_env_t *env);

/*
 * Populates a condition from a om node containing a condition. After this a 
 * specific condition will be built and set to this condition. 
 * @param cond pointer to a condition object
 * @param env pointer to environment struct
 * @param node om node containing a condition
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_condition_build(saml_condition_t *cond, 
					 axiom_node_t *node, const axutil_env_t *env);

/* 
 * Serialize a condition to a om node. 
 * @param cond pointer to a condition object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_condition_to_om(saml_condition_t *cond, 
					 axiom_node_t *parent, const axutil_env_t *env);

/*
 * Set the specific condition for this condition.
 * @param cond pointer to a condition object
 * @param env pointer to environment struct
 * @param condition the specific condition
 * @param type condition type
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_condition_set_condition(saml_condition_t *cond, 
							 const axutil_env_t *env, void * condition, 
							 saml_cond_type_t type);

/*
 * Set the type of the conition. 
 * @param cond pointer to a condition object
 * @param env pointer to environment struct
 * @param type specific type of the condition
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_condition_set_type(saml_condition_t *cond, 
						const axutil_env_t *env, saml_cond_type_t type);

/*
 * Get the specific condtion in this generic condition.
 * @param cond pointer to a condition object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void * AXIS2_CALL 
saml_condition_get_condition(saml_condition_t *cond, const axutil_env_t *env);

/*
 * Get the type of the specific condtion in this generic condition.
 * @param cond pointer to a condition object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN saml_cond_type_t AXIS2_CALL 
saml_condition_get_type(saml_condition_t *cond, const axutil_env_t *env);

/* audio restriction */

/*
 * Populates an audi restriction condition from an om node.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param node om node containing an audience restriction condition
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_audi_restriction_cond_build(saml_audi_restriction_cond_t *arc, 
								 axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize an saml_audi_restriction_cond_t object in to an om node.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t *AXIS2_CALL 
saml_audi_restriction_cond_to_om(saml_audi_restriction_cond_t *arc, 
								 axiom_node_t *parent, const axutil_env_t *env);

/*
 * Free a saml_aud_restriction_conf object.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_audi_restriction_cond_free(saml_audi_restriction_cond_t *arc, 
								const axutil_env_t *env);

/*
 * Create a saml_aud_restriction_conf object.
 * @param env pointer to environment struct
 * @return a ponter to saml_aud_restriction_conf object
 */
AXIS2_EXTERN saml_audi_restriction_cond_t * AXIS2_CALL 
saml_audi_restriction_cond_create(const axutil_env_t *env);

/*
 * Return a list of URI references that identifies a list of intended audiences.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_audi_restriction_cond_get_audiences(saml_audi_restriction_cond_t *arc, 
										 const axutil_env_t *env);

/*
 * Set a list of URI references that identifies a list of intended audiences.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_audi_restriction_cond_set_audiences(saml_audi_restriction_cond_t *cond, 
										 const axutil_env_t *env, axutil_array_list_t *list);

/*
 * Remove a URI reference that identifies an intended audiences.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param env pointer to environment struct
 * @param index the number of the audience in the list, to be removed
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_audi_restriction_cond_remove_audiences(saml_audi_restriction_cond_t *cond, 
											const axutil_env_t *env, int index);

/*
 * Ad a URI reference that identifies an intended audiences.
 * @param arc a ponter to saml_aud_restriction_conf object
 * @param env pointer to environment struct
 * @param audience a new audience to be added
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_audi_restriction_cond_add_audience(saml_audi_restriction_cond_t *cond, 
										const axutil_env_t *env, axis2_char_t *audience);


/* action */

/*
 * Create a saml_action_t.
 * @param env pointer to environment struct
 * @return pointer to saml_action_t 
 */
AXIS2_EXTERN saml_action_t * AXIS2_CALL 
saml_action_create(const axutil_env_t *env);

/*
 * Free a saml_action_t.
 * @param action pointer to saml_action_t 
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_action_free(saml_action_t *action, const axutil_env_t *env);

/*
 * Populates a saml action from a om node containing a saml action.
 * @param action pointer to saml_action_t 
 * @param node om node conatining a saml action
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_action_build(saml_action_t *action, axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize a action_t object to an om node.
 * @param action pointer to saml_action_t 
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_action_to_om(saml_action_t *action, 
				  axiom_node_t *parent, const axutil_env_t *env);

/*
 * Get an action sought to be performed on the specified resource.
 * @param action pointer to saml_action_t 
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_action_get_data(saml_action_t *action, const axutil_env_t *env);

/*
 * Get a URI reference representing the namespace in which the name of the 
 * specified action is to be interpreted.
 * @param action pointer to saml_action_t 
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_action_get_namespace(saml_action_t *action, const axutil_env_t *env);

/*
 * Set an action sought to be performed on the specified resource.
 * @param action pointer to saml_action_t 
 * @param env pointer to environment struct
 * @param data an action to be performed
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_action_set_data(saml_action_t *action, const axutil_env_t *env, 
					 axis2_char_t *data);

/*
 * Set a URI reference representing the namespace in which the name of the 
 * specified action is to be interpreted.
 * @param action pointer to saml_action_t 
 * @param env pointer to environment struct
 * @param name_space a URI reference
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_action_set_namespace(saml_action_t *action, const axutil_env_t *env, 
						  axis2_char_t *name_space);

/* evidence */
AXIS2_EXTERN saml_evidence_t * AXIS2_CALL 
saml_evidence_create(const axutil_env_t *env);

AXIS2_EXTERN void AXIS2_CALL 
saml_evidence_free(saml_evidence_t *evidence, const axutil_env_t *env);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_build(saml_evidence_t *evidence, 
					axiom_node_t *node, const axutil_env_t *env);

AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_evidence_to_om(saml_evidence_t *evidence, axiom_node_t *parent, 
					const axutil_env_t *env);

AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_evidence_get_assertions(saml_evidence_t *evidence, const axutil_env_t *env);

AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL 
saml_evidence_get_assertion_ids(saml_evidence_t *evidence, const axutil_env_t *env);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_set_assertions(saml_evidence_t *evidence, 
							 const axutil_env_t *env, axutil_array_list_t *list);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_remove_assertion(saml_evidence_t *evidence, 
							   const axutil_env_t *env, int index);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_add_assertion(saml_evidence_t *evidence, 
							const axutil_env_t *env, saml_assertion_t *assertion);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_set_assertion_ids(saml_evidence_t *evidence, 
								const axutil_env_t *env, axutil_array_list_t *list);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_remove_assertion_id(saml_evidence_t *evidence, 
								  const axutil_env_t *env, int index);

AXIS2_EXTERN int AXIS2_CALL 
saml_evidence_add_assertion_id(saml_evidence_t *evidence, 
							   const axutil_env_t *env, axis2_char_t *assertion_id);

/* atrribute designature */

/* 
 * Create a saml_attr_desig_t. 
 * @param env pointer to environment struct
 * @return pointer to saml_attr_desig_t
 */
AXIS2_EXTERN saml_attr_desig_t * AXIS2_CALL 
saml_attr_desig_create(const axutil_env_t *env);

/* 
 * Free a saml_attr_desig_t. 
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_attr_desig_free(saml_attr_desig_t *attr_desig, const axutil_env_t *env);

/*
 * Populates a saml_attr_desig_t from a om node contailing a saml attriibute desgnator
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param node om node containing saml attriibute desgnator
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_desig_build(saml_attr_desig_t *attr_desig, 
					  axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize a saml_attr_desig_t to an om node.
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_attr_desig_to_om(saml_attr_desig_t *attr_desig, 
					  axiom_node_t *parent, const axutil_env_t *env);

/* 
 * Get the name of the attribute.
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param env pointer to environment struct 
 * @return a string name of the attribute
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_attr_desig_get_name(saml_attr_desig_t *attr_desig, const axutil_env_t *env);

/*
 * Get the namespace in which the AttributeName elements are interpreted.
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param env pointer to environment struct 
 * @return a string representing a namespace
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_attr_desig_get_namespace(saml_attr_desig_t *attr_desig, const axutil_env_t *env);

/* 
 * Set the name of the attribute.
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param env pointer to environment struct 
 * @param name a string name of the attribute
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_desig_set_name(saml_attr_desig_t *attr_desig, 
						 const axutil_env_t *env, axis2_char_t *name);

/*
 * Set the namespace in which the AttributeName elements are interpreted.
 * @param attr_desig a pointer to saml_attr_desig_t
 * @param env pointer to environment struct 
 * @param name_space a string representing a namespace
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_desig_set_namespace(saml_attr_desig_t *attr_desig, 
							  const axutil_env_t *env, axis2_char_t *name_space);

/* attribute */

/*
 * Create a saml_attr_t.
 * @param env pointer to environment struct 
 * @return pointer to saml_attr_t
 */
AXIS2_EXTERN saml_attr_t * AXIS2_CALL 
saml_attr_create(const axutil_env_t *env);

/*
 * Free a saml_attr_t.
 * @param attr pointer to saml_attr_t
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_attr_free(saml_attr_t *attr, const axutil_env_t *env);

/*
 * Populates a saml_attr_t from an om node containing a saml attribute.
 * @param attr pointer to saml_attr_t
 * @node an om node containing a saml attribute
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_build(saml_attr_t *attr, axiom_node_t *node, const axutil_env_t *env);

/*
 * Serialize a saml_attr_t in to an om node.
 * @param attr pointer to saml_attr_t
 * @param parent if specified created node will be a child of this node  
 * @param env pointer to environment struct 
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_attr_to_om(saml_attr_t *attr, axiom_node_t *parent, const axutil_env_t *env);

/* 
 * Get the name of the attribute.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @return a string name of the attribute
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_attr_get_name(saml_attr_t *attr, const axutil_env_t *env);

/*
 * Get the namespace in which the AttributeName elements are interpreted.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @return a string representing a namespace
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_attr_get_namespace(saml_attr_t *attr_stmt, const axutil_env_t *env);

/* 
 * Set the name of the attribute.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @param name a string name of the attribute
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_set_name(saml_attr_t *attr, const axutil_env_t *env, axis2_char_t *name);

/*
 * Set the namespace in which the AttributeName elements are interpreted.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @param name_space a string representing a namespace
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_set_namespace(saml_attr_t *attr, const axutil_env_t *env, 
						axis2_char_t *name_space);

/*
 * Set the values of the attribute as a list of om nodes.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @param list a om node list
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_set_values(saml_attr_t *attr, const axutil_env_t *env, 
					 axutil_array_list_t *list);

/*
 * Remove om node at the specified index.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @param index index number of the om node to be removed
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_remove_value(saml_attr_t *attr, const axutil_env_t *env, int index);

/*
 * Add a om node to the attribute value list.
 * @param attr a pointer to saml_attr_t
 * @param env pointer to environment struct 
 * @param value an om node
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_attr_add_value(saml_attr_t *attr, const axutil_env_t *env, axiom_node_t *value);


/*named id*/

/*
 * Create a SAML named id object
 * @param env pointer to environment struct
 * @return saml named id object
 */
AXIS2_EXTERN saml_named_id_t * AXIS2_CALL 
saml_named_id_create(const axutil_env_t *env);

/*
 * Free a saml named id object
 * @param named_id named_id to be freed
 * @param env pointer to environment struct
 */
AXIS2_EXTERN void AXIS2_CALL 
saml_named_id_free(saml_named_id_t *named_id, const axutil_env_t *env);

/*
 * Build a saml named id from an om node containing a saml named identifier
 * @param named_id named id object
 * @param node om node containing the saml named identifier
 * @param env pointer to environment struct
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_named_id_build(saml_named_id_t *named_id, axiom_node_t *node, 
					const axutil_env_t *env);

/*
 * Serialize a named id object in to an om node.
 * @param named_id named id object
 * @param parent if specified this will be the parent of the newely created node
 * @param env pointer to environment struct
 */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL 
saml_named_id_to_om(saml_named_id_t *id, axiom_node_t *parent, 
					const axutil_env_t *env);

/* 
 * Get the name of the named identifier.
 * @param named_id named id object
 * @param env pointer to environment struct
 * @return name as a string
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_named_id_get_name(saml_named_id_t *id, const axutil_env_t *env);

/*
 * Get a URI reference representing the format in which the <NameIdentifier> 
 * information is provided.
 * @param named_id named id object
 * @param env pointer to environment struct
 * @return format as a URI string
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_named_id_get_format(saml_named_id_t *id, const axutil_env_t *env);

/*
 * Get the security or administrative domain that qualifies the name of the 
 * subject.
 * @param named_id named id object
 * @param env pointer to environment struct
 * @return string representing the domain
 */
AXIS2_EXTERN axis2_char_t * AXIS2_CALL 
saml_named_id_get_name_qualifier(saml_named_id_t *id, const axutil_env_t *env);

/* 
 * Set the name of the named identifier.
 * @param named_id named id object
 * @param env pointer to environment struct
 * @param name name as a string
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_named_id_set_name(saml_named_id_t *id, 
					   const axutil_env_t *env, axis2_char_t *name);

/*
 * Set a URI reference representing the format in which the <NameIdentifier> 
 * information is provided.
 * @param named_id named id object
 * @param env pointer to environment struct
 * @param format format of the nameidentifier
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_named_id_set_format(saml_named_id_t *id, 
						 const axutil_env_t *env, axis2_char_t *format);

/*
 * Set the security or administrative domain that qualifies the name of the 
 * subject.
 * @param named_id named id object
 * @param env pointer to environment struct
 * @param qualifier string representing the domain 
 */
AXIS2_EXTERN int AXIS2_CALL 
saml_named_id_set_name_qualifier(saml_named_id_t *id, 
								 const axutil_env_t *env, axis2_char_t *qualifier);


/* private method */
AXIS2_EXTERN int AXIS2_CALL saml_util_set_sig_ctx_defaults(oxs_sign_ctx_t *sig_ctx, const axutil_env_t *env, axis2_char_t *id);

/* Get the session key from a assertion. Session key is inside the SAML 
 * token as an EncryptedKey 
 * @param env pointer to environment struct
 * @param assertion an saml assertion node
 * @param pvt_key private key used to encrypt the session key
 */
AXIS2_EXTERN oxs_key_t * AXIS2_CALL
saml_assertion_get_session_key(const axutil_env_t *env, axiom_node_t *assertion, 
                               openssl_pkey_t *pvt_key);

#ifdef __cplusplus
}
#endif


#endif