Skip to content

Commit 65ac2f9

Browse files
Changed to Apache 2.0 license
1 parent e2765ea commit 65ac2f9

File tree

143 files changed

+1766
-2783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+1766
-2783
lines changed

LICENSE

+201-674
Large diffs are not rendered by default.

README.md

+80-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,90 @@
1-
![Logo](https://github.com/litsec/eidas-opensaml/blob/master/docs/img/litsec-small.png)
1+
![Logo](https://github.com/litsec/opensaml-ext/blob/master/docs/img/litsec-small.png)
22

33
------
44

55
# opensaml-ext
66

7-
Utility extensions for OpenSAML 2.X and 3.X.
7+
Utility extensions for OpenSAML 3.X.
88

9-
This open source package is an extension to OpenSAML that offers easy to use support for handling object creation, attributes, metadata, request and response handling and much more.
9+
This open source package is an extension to OpenSAML 3.X that offers utility classes and interfaces such as:
1010

11-
See the [opensaml-ext Wiki](https://github.com/litsec/opensaml-ext/wiki) for detailed descriptions of the features.
11+
* Easier initialization of the OpenSAML libraries.
12+
* Utility methods for creating OpenSAML objects that does not require using the builder classes directly.
13+
* Utility methods for marshalling and unmarshalling.
14+
* Simplified support for signing XML objects.
15+
* An abstraction for metadata handling making it easier to download and use SAML metadata.
16+
* Spring Framework factory beans for easier integration in a Spring environment.
17+
* A builder pattern for some commonly used objects, such as creating SAML attribute objects, entity descriptors (metadata) or authentication requests.
1218

13-
Copyright © 2017, [Litsec AB](http://www.litsec.se). Licensed under the GNU General Public License 3, for details see [LICENSE](LICENSE).
19+
Java API documentation of the opensaml-ext library is found at [https://litsec.github.io/opensaml-ext/javadoc](https://litsec.github.io/opensaml-ext/javadoc/).
20+
21+
*Limited support for OpenSAML 2.X is also part of the project. This library will not be updated and its purpose is to support older libraries built using OpenSAML 2.*
22+
23+
> Note: Some features of this library is still experimental.
24+
25+
### Maven and opensaml-ext
26+
27+
The opensaml-ext project artifacts are published to Maven central.
28+
29+
Include the following snippet in your Maven POM to add opensaml-ext as a dependency for your project.
30+
31+
```
32+
<dependency>
33+
<groupId>se.litsec.opensaml</groupId>
34+
<artifactId>opensaml3-ext</artifactId>
35+
<version>${opensaml-ext.version}</version>
36+
</dependency>
37+
```
38+
39+
If you are making use of the Spring features in opensaml-ext you need to explicitly add those dependencies. For example:
40+
41+
```
42+
<dependency>
43+
<groupId>org.springframework</groupId>
44+
<artifactId>spring-beans</artifactId>
45+
<version>${spring.version}</version>
46+
</dependency>
47+
48+
<dependency>
49+
<groupId>org.springframework</groupId>
50+
<artifactId>spring-context</artifactId>
51+
<version>${spring.version}</version>
52+
</dependency>
53+
```
54+
55+
Currently, opensaml-ext uses version `4.3.7.RELEASE` of Spring.
56+
57+
If you are using the OpenSAML 2.X version of the library (with limited features) use:
58+
59+
```
60+
<dependency>
61+
<groupId>se.litsec.opensaml</groupId>
62+
<artifactId>opensaml2-ext</artifactId>
63+
<version>${opensaml-ext.version}</version>
64+
</dependency>
65+
```
66+
### Initializing the OpenSAML library
67+
68+
The OpenSAML library needs to be initialized before it can be used. The opensaml-ext library offers a simple default way of doing this.
69+
70+
In order to initialize the OpenSAML library, include the following code somewhere in your application. It must be exectuted before any other code that is dependent on OpenSAML runs.
71+
72+
```
73+
OpenSAMLInitializer.getInstance().initialize();
74+
```
75+
76+
The OpenSAMLInitializer may also be supplied a customized parser pool. If none is assigned, a default parser pool is used.
77+
78+
If you are using opensaml-ext in a Spring environment you may use the `OpenSAMLInitializerBean` to initialize OpenSAML. Include the following bean declaration in your Spring XML context:
79+
80+
```
81+
<bean id="openSamlInitializer"
82+
class="se.litsec.opensaml.config.spring.OpenSAMLInitializerBean"
83+
scope="singleton"
84+
lazy-init="false" />
85+
```
86+
87+
88+
Copyright &copy; 2016-2018, [Litsec AB](http://www.litsec.se). Licensed under version 2.0 of the [Apache License](http://www.apache.org/licenses/LICENSE-2.0).
1489

1590

docs/img/litsec-small.png

12.6 KB
Loading

opensaml2/pom.xml

+15-5
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66
<groupId>se.litsec.opensaml</groupId>
77
<artifactId>opensaml2-ext</artifactId>
88
<packaging>jar</packaging>
9-
<version>0.9.2</version>
9+
<version>0.9.3-SNAPSHOT</version>
1010

1111
<name>Litsec :: OpenSAML 2.X utility extensions</name>
1212
<description>OpenSAML 2.X utility extension library</description>
1313
<url>https://github.com/litsec/opensaml-ext</url>
1414

1515
<licenses>
1616
<license>
17-
<name>GNU General Public License, Version 3</name>
18-
<url>http://www.gnu.org/licenses/gpl-3.0.html</url>
17+
<name>The Apache Software License, Version 2.0</name>
18+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
1919
<distribution>repo</distribution>
20-
<comments>A free, copyleft license for software and other kinds of works</comments>
2120
</license>
2221
</licenses>
23-
22+
2423
<scm>
2524
<connection>scm:https://github.com/litsec/opensaml-ext.git</connection>
2625
<developerConnection>scm:https://github.com/litsec/opensaml-ext.git</developerConnection>
@@ -36,6 +35,11 @@
3635
</developer>
3736
</developers>
3837

38+
<organization>
39+
<name>Litsec AB</name>
40+
<url>http://www.litsec.se</url>
41+
</organization>
42+
3943
<properties>
4044
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4145
<java.version>1.8</java.version>
@@ -180,6 +184,12 @@
180184
</filesets>
181185
</configuration>
182186
</plugin>
187+
188+
<plugin>
189+
<groupId>org.apache.maven.plugins</groupId>
190+
<artifactId>maven-project-info-reports-plugin</artifactId>
191+
<version>2.9</version>
192+
</plugin>
183193

184194
</plugins>
185195

opensaml2/src/main/java/se/litsec/opensaml/core/AbstractSAMLObjectBuilder.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
/*
2-
* The opensaml-ext project is an open-source package that extends OpenSAML
3-
* with useful extensions and utilities.
2+
* Copyright 2016-2018 Litsec AB
43
*
5-
* More details on <https://github.com/litsec/opensaml-ext>
6-
* Copyright (C) 2017 Litsec AB
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* http://www.apache.org/licenses/LICENSE-2.0
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
17-
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
2015
*/
2116
package se.litsec.opensaml.core;
2217

opensaml2/src/main/java/se/litsec/opensaml/core/LocalizedString.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
/*
2-
* The opensaml-ext project is an open-source package that extends OpenSAML
3-
* with useful extensions and utilities.
2+
* Copyright 2016-2018 Litsec AB
43
*
5-
* More details on <https://github.com/litsec/opensaml-ext>
6-
* Copyright (C) 2017 Litsec AB
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* http://www.apache.org/licenses/LICENSE-2.0
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
17-
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
2015
*/
2116
package se.litsec.opensaml.core;
2217

opensaml2/src/main/java/se/litsec/opensaml/core/SAMLObjectBuilder.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
/*
2-
* The opensaml-ext project is an open-source package that extends OpenSAML
3-
* with useful extensions and utilities.
2+
* Copyright 2016-2018 Litsec AB
43
*
5-
* More details on <https://github.com/litsec/opensaml-ext>
6-
* Copyright (C) 2017 Litsec AB
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* http://www.apache.org/licenses/LICENSE-2.0
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
17-
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
2015
*/
2116
package se.litsec.opensaml.core;
2217

opensaml2/src/main/java/se/litsec/opensaml/saml2/attribute/AttributeBuilder.java

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
/*
2-
* The opensaml-ext project is an open-source package that extends OpenSAML
3-
* with useful extensions and utilities.
2+
* Copyright 2016-2018 Litsec AB
43
*
5-
* More details on <https://github.com/litsec/opensaml-ext>
6-
* Copyright (C) 2017 Litsec AB
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
77
*
8-
* This program is free software: you can redistribute it and/or modify
9-
* it under the terms of the GNU General Public License as published by
10-
* the Free Software Foundation, either version 3 of the License, or
11-
* (at your option) any later version.
8+
* http://www.apache.org/licenses/LICENSE-2.0
129
*
13-
* This program is distributed in the hope that it will be useful,
14-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
* GNU General Public License for more details.
17-
*
18-
* You should have received a copy of the GNU General Public License
19-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
2015
*/
2116
package se.litsec.opensaml.saml2.attribute;
2217

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/*
2+
* Copyright 2016-2018 Litsec AB
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package se.litsec.opensaml.saml2.attribute;
17+
18+
import org.opensaml.saml2.core.Attribute;
19+
20+
/**
21+
* An attribute template is a template of a SAML attribute, i.e., it represents the name, friendly name and name format
22+
* but not the value of the attribute.
23+
* <p>
24+
* A template may be useful when defining attribute sets and/or attribute release policies.
25+
* </p>
26+
*
27+
* @author Martin Lindström ([email protected])
28+
*/
29+
public class AttributeTemplate {
30+
31+
/** The attribute name. */
32+
private String name;
33+
34+
/** The attribute friendly name. */
35+
private String friendlyName;
36+
37+
/**
38+
* The name format of this attribute. The default is {@code urn:oasis:names:tc:SAML:2.0:attrname-format:uri} (
39+
* {@link Attribute#URI_REFERENCE}).
40+
*/
41+
private String nameFormat = Attribute.URI_REFERENCE;
42+
43+
/**
44+
* Creates an attribute template with the given name and friendly name, the default name format
45+
* {@code urn:oasis:names:tc:SAML:2.0:attrname-format:uri} ({@link Attribute#URI_REFERENCE}) and not multi-valued.
46+
*
47+
* @param name
48+
* the attribute name
49+
* @param friendlyName
50+
* the attribute friendly name (optional)
51+
*/
52+
public AttributeTemplate(String name, String friendlyName) {
53+
this(name, friendlyName, Attribute.URI_REFERENCE);
54+
}
55+
56+
/**
57+
* Creates an attribute template with the given name, friendly name and name format.
58+
*
59+
* @param name
60+
* the attribute name
61+
* @param friendlyName
62+
* the attribute friendly name
63+
* @param nameFormat
64+
* the name format
65+
*/
66+
public AttributeTemplate(String name, String friendlyName, String nameFormat) {
67+
if (name == null) {
68+
throw new NullPointerException("'name' must not be null");
69+
}
70+
this.name = name;
71+
this.friendlyName = friendlyName;
72+
this.nameFormat = nameFormat != null ? nameFormat : Attribute.URI_REFERENCE;
73+
}
74+
75+
/**
76+
* Get the name of this attribute template.
77+
*
78+
* @return the name of this attribute template
79+
*/
80+
public String getName() {
81+
return this.name;
82+
}
83+
84+
/**
85+
* Get the friendly name of this attribute template.
86+
*
87+
* @return the friendly name of this attribute template
88+
*/
89+
public String getFriendlyName() {
90+
return this.friendlyName;
91+
}
92+
93+
/**
94+
* Get the name format of this attribute template.
95+
*
96+
* @return the name format of this attribute template
97+
*/
98+
public String getNameFormat() {
99+
return this.nameFormat;
100+
}
101+
102+
/**
103+
* Based on the attribute template an {@link AttributeBuilder} object is created.
104+
*
105+
* @return a builder
106+
*/
107+
public AttributeBuilder createBuilder() {
108+
AttributeBuilder builder = new AttributeBuilder(this.name);
109+
return builder.friendlyName(this.friendlyName).nameFormat(this.nameFormat);
110+
}
111+
112+
}

0 commit comments

Comments
 (0)