summaryrefslogtreecommitdiffstats
path: root/lasso/saml-2.0/saml2_helper.h
blob: 2c231a076efc8a0baf34b9ce633c6660924c5e0d (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
/* $Id$
 *
 * Lasso - A free implementation of the Liberty Alliance specifications.
 *
 * Copyright (C) 2004-2007 Entr'ouvert
 * http://lasso.entrouvert.org
 *
 * Authors: See AUTHORS file in top-level directory.
 *
 * 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
 */

#ifndef __LASSO_SAML20_SAML2_HELPER_H__
#define __LASSO_SAML20_SAML2_HELPER_H__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "../export.h"

#include "../xml/saml-2.0/saml2_assertion.h"
#include "../xml/saml-2.0/saml2_name_id.h"
#include "../xml/saml-2.0/saml2_encrypted_element.h"
#include "../id-ff/provider.h"
#include "../id-ff/server.h"

typedef enum {
	LASSO_SAML2_ASSERTION_VALID,
	LASSO_SAML2_ASSERTION_INVALID,
	LASSO_SAML2_ASSERTION_INDETERMINATE
} LassoSaml2AssertionValidationState;

#define LASSO_DURATION_MINUTE 60
#define LASSO_DURATION_HOUR 3600
#define LASSO_DURATION_DAY 24*2600
#define LASSO_DURATION_WEEK LASSO_DURATION_DAY*7

LASSO_EXPORT gboolean lasso_saml2_assertion_has_audience_restriction(
		LassoSaml2Assertion *saml2_assertion);

LASSO_EXPORT gboolean lasso_saml2_assertion_is_audience_restricted(
		LassoSaml2Assertion *saml2_assertion, char* providerID);

LASSO_EXPORT LassoSaml2NameID* lasso_saml2_name_id_build_persistent(const char *id,
		const char *idpID, const char *providerID);

LASSO_EXPORT LassoSaml2EncryptedElement*
	lasso_saml2_encrypted_element_build_encrypted_persistent_name_id(const char *id,
		const char *idpID, const LassoProvider *provider);

LASSO_EXPORT void lasso_saml2_assertion_set_subject_name_id(LassoSaml2Assertion *saml2_assertion,
		LassoNode *node);

LASSO_EXPORT void lasso_saml2_assertion_set_subject_confirmation_name_id(
		LassoSaml2Assertion *saml2_assertion, LassoNode *node);

LASSO_EXPORT void lasso_saml2_assertion_set_subject_confirmation_data(
		LassoSaml2Assertion *saml2_assertion, time_t tolerance, time_t length,
		const char *Recipient, const char *InResponseTo, const char *Address);

LASSO_EXPORT void lasso_saml2_assertion_set_basic_conditions(LassoSaml2Assertion *saml2_assertion,
		time_t tolerance, time_t length, gboolean one_time_use);

LASSO_EXPORT void lasso_saml2_assertion_add_audience_restriction(
		LassoSaml2Assertion *saml2_assertion, const char *providerID);

LASSO_EXPORT void lasso_saml2_assertion_add_proxy_limit (LassoSaml2Assertion *saml2_assertion,
		int proxy_count, GList *proxy_audiences);

LASSO_EXPORT LassoSaml2AssertionValidationState lasso_saml2_assertion_validate_conditions(
		LassoSaml2Assertion *saml2_assertion, const char *relaying_party_providerID);

LASSO_EXPORT LassoProvider* lasso_saml2_assertion_get_issuer_provider(
		const LassoSaml2Assertion *saml2_assertion, const LassoServer *server);

LASSO_EXPORT int lasso_server_saml2_assertion_setup_signature(LassoServer *server,
		LassoSaml2Assertion *saml2_assertion);

LASSO_EXPORT int lasso_saml2_assertion_add_attribute_with_node(LassoSaml2Assertion *assertion, const
		char *name, const char *nameformat, LassoNode *content);

LASSO_EXPORT LassoSaml2SubjectConfirmationData*
	lasso_saml2_assertion_get_subject_confirmation_data(LassoSaml2Assertion *saml2_assertion,
			gboolean create);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __LASSO_SAML20_SAML2_HELPER_H__ */