You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Saml2Test application was created to allow the developers to test a SAML2 Service Provider (SP) application against an Identity Provider (IdP). The application allows you to:
4
+
5
+
1. Produce a SP metadata.xml that can be uploaded to an Identity Provider
6
+
2. Login via a SAML2 AuthnRequest
7
+
3. Access user attributes provided in the SAML2 Assertion
8
+
3. Logout via a SAML2 LogoutRequest
9
+
10
+
## Required Steps
11
+
12
+
### Create host file entry
13
+
14
+
The config.yml is configured for the testapp to be available at: https://netsaml2-testapp.local. Add the following to your /etc/hosts entry (or the equivalent on windows).
15
+
16
+
127.0.0.1 netsaml2-testapp.local netsaml2-testapp
17
+
18
+
### Generate new Service Provider (SP) signing Key and Certificate
19
+
20
+
This is optional - you can generate your own certificates or use the existing certificates from the git repository.
The application starts and accepts browser connections on port 3000:
31
+
32
+
Access http://localhost:3000
33
+
34
+
### Run lighttpd to proxy https to the Saml2Test application
35
+
36
+
Many SAML2 Identity Providers will not allow the application (Service Provider) URL to be http and force you to specify https to use SAML2. lighttpd is used to listen on port 443 and use https protocol so that the Identity Provider can redirect or POST to a https site. lighttpd then proxies that communication to the Dancer application listening on port 3000.
37
+
38
+
1. cd xt/testapp
39
+
2. sudo lighttpd -D -f lighttpd.conf
40
+
41
+
Note that the command requires sudo to allow it to use the default https port of 443.
42
+
43
+
TODO: maybe change it to use 8443
44
+
45
+
### Create your metadata.xml file
46
+
47
+
Download the metadata for you configured application from your Identity Provider and save it to:
48
+
49
+
xt/testapp/metadata.xml
50
+
51
+
### Run lighttpd to deliver metadata.xml
52
+
53
+
Net::SAML2 requires access to a URL containing the metadata. The simplest method to provide this is to run the provided lighttpd-metadata.conf file:
54
+
55
+
1. cd xt/testapp
56
+
2. lighttpd -D -f lighttpd-metadata.conf
57
+
58
+
The metadata has been configured to be available at: http://localhost:8880/metadata.xml.
59
+
60
+
Note that the configuration attempts to only deliver a file named metadata.xml from the xt/testapp directory. There are no guarantees - this is a test application so verify your own security.
61
+
62
+
### Access the testapp to download the application metadata
63
+
64
+
Saml2Test provides a metadata.xml for the Application that can be used to upload to the Identity Provider to make the configuration simpler.
65
+
66
+
1. Access http://localhost:3000
67
+
2. Click *SP Metadata* to download the metadata.xml
68
+
3. Save the metadata.xml file for upload to the Identity Provider
69
+
70
+
### Configure your Identity Provider
71
+
72
+
Depending on the Identity Provider this can range from simple to easy. For testing purposes most Identity Providers will provide a free developer account. Some require you to define users first, others will simply allow you to use whatever your admin user is as a SAML user.
73
+
74
+
If there is an option to upload the metadata.xml that is probably your first step as it will set most configuration items properly for you.
75
+
76
+
Saml2Test expects the Identity Provider to provide an assertion with the following values:
77
+
78
+
1. DN
79
+
2. CN
80
+
3. EmailAddress
81
+
4. FirstName
82
+
5. Address
83
+
6. Phone
84
+
7. EmployeeNumber
85
+
86
+
Note that DN and CN (and others) may not be available. That can be customized in views/user.tt if you want to choose other options. However the Identity Provider must provide the assertion attributes that match the expected names in views/user.tt.
87
+
88
+
## Debugging
89
+
90
+
If you are making changes to Net::SAML2 and want to use the Saml2Test to test those changes do the following:
That allows you to test against the version of Net::SAML2 that you are modifying. Note that Dancer caches the version it started with including the Net::SAML2 module so you will need to restart Saml2Test.pl to test the changes you made.
0 commit comments