Skip to content

Commit 24b428c

Browse files
author
Jose Alfredo Serrano
committed
Improve the README
1 parent c10c7ee commit 24b428c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ At *java-saml-tookit-jspsample/src/main/resources* folder is the *onelogin.saml.
178178
#### Settings
179179
First of all we need to configure the toolkit. The SP's info, the IdP's info, and in some cases, configuration for advanced security issues, such as signatures and encryption.
180180

181+
##### Properties File
181182
All the settings are defined in one unique file; by default, the Auth class loads a *onelogin.saml.properties* file with the Auth() method, but if we named it in a different way, we can use Auth(filename);
182183

183184
Here are the list of properties to be defined on the settings file:
@@ -337,7 +338,27 @@ onelogin.saml2.organization.lang = en
337338
onelogin.saml2.contacts.technical.given_name = Technical Guy
338339
onelogin.saml2.contacts.technical.email_address = technical@example.com
339340
onelogin.saml2.contacts.support.given_name = Support Guy
340-
onelogin.saml2.contacts.support.email_address = support@@example.com
341+
onelogin.saml2.contacts.support.email_address = support@example.com
342+
```
343+
344+
##### Dynamic Settings
345+
It is possible to build settings programatically. You can load your values from different sources such as files, databases, or generated values.
346+
347+
The `SettingsBuilder` class exposes the method `fromValues(Map<String, Object> samlData)` which let you build your settings dynamically. The `key` strings are the same from the *Properties file*
348+
```java
349+
Map<String, Object> samlData = new HashMap<>();
350+
samlData.put("onelogin.saml2.sp.entityid", "http://localhost:8080/java-saml-tookit-jspsample/metadata.jsp");
351+
samlData.put("onelogin.saml2.sp.assertion_consumer_service.url", new URL("http://localhost:8080/java-saml-tookit-jspsample/acs.jsp"));
352+
samlData.put("onelogin.saml2.security.want_xml_validation",true);
353+
samlData.put("onelogin.saml2.sp.x509cert", myX509CertInstance);
354+
355+
SettingsBuilder builder = new SettingsBuilder();
356+
Saml2Settings settings = builder.fromValues(samlData).build();
357+
```
358+
359+
To instantiate the `Auth` class you write
360+
```java
361+
Auth auth = new Auth(settings, request, response);
341362
```
342363

343364
#### The HttpRequest

0 commit comments

Comments
 (0)