-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
166 lines (129 loc) · 6.42 KB
/
README
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
MongoDB data and persistent ID connector for use with the Shibboleth 2.x IdP.
DOCUMENTATION
-------------
https://wiki.shibboleth.net/confluence/display/SHIB2/MongoDB+connector
INSTALLATION
------------
1. Add the project jar and all its dependencies to the Shibboleth IdP source
lib directory.
2. Re-install the IdP using the install script to build and deploy a new idp.war
CONFIGURATION
-------------
Enable the mongodb connector in $IDP_CONFIG_DIR/conf/attribute-resolver.xml
1. Add namespace and the xsd schema to the root element:
xmlns:uid="http://dev.unitedid.org/NS/mongodb-connector"
http://dev.unitedid.org/NS/mongodb-connector classpath:/schema/mongodb-connector.xsd
2. Adding the mongodb data connector
---------------------------------------------------------------------------------------
EXAMPLE 1 (one mongodb server):
---------------------------------------------------------------------------------------
<resolver:DataConnector id="myMongo" xsi:type="uid:MongoDbDataConnector"
mongoDbName="idp"
mongoCollection="users">
<uid:MongoHost host="server1.example.com" port="27017" />
<uid:QueryTemplate>
<![CDATA[
{ 'userName' : '$requestContext.principalName' }
]]>
</uid:QueryTemplate>
</resolver:DataConnector>
---------------------------------------------------------------------------------------
EXAMPLE 2 (multiple mongodb servers):
---------------------------------------------------------------------------------------
<resolver:DataConnector id="myMongo" xsi:type="uid:MongoDbDataConnector"
mongoDbName="idp"
mongoCollection="users">
<uid:MongoHost host="server1.example.com" port="27017" />
<uid:MongoHost host="server2.example.com" port="27017" />
<uid:MongoHost host="server3.example.com" port="27017" />
<uid:QueryTemplate>
<![CDATA[
{ 'userName' : '$requestContext.principalName' }
]]>
</uid:QueryTemplate>
</resolver:DataConnector>
---------------------------------------------------------------------------------------
EXAMPLE 3 (map document fields to an attributeId):
---------------------------------------------------------------------------------------
<resolver:DataConnector id="myMongo" xsi:type="uid:MongoDbDataConnector"
mongoDbName="idp"
mongoCollection="users">
<uid:MongoHost host="server1.example.com" port="27017" />
<uid:QueryTemplate>
<![CDATA[
{ 'userName' : '$requestContext.principalName' }
]]>
</uid:QueryTemplate>
<uid:AttributeMap mongoKey="userName" attributeID="uid" />
<uid:AttributeMap mongoKey="email" attributeID="mail" />
</resolver:DataConnector>
---------------------------------------------------------------------------------------
EXAMPLE 4 (map embedded HashMap fields to an attributeId):
---------------------------------------------------------------------------------------
<resolver:DataConnector id="myMongo" xsi:type="uid:MongoDbDataConnector"
mongoDbName="idp"
mongoCollection="users">
<uid:MongoHost host="server1.example.com" port="27017" />
<uid:QueryTemplate>
<![CDATA[
{ 'userName' : '$requestContext.principalName' }
]]>
</uid:QueryTemplate>
<uid:AttributeMap mongoKey="userName" attributeID="uid" />
<uid:AttributeMap mongoKey="email" attributeID="mail" />
<uid:AttributeMap mongoKey="address">
<uid:ValueMap mongoKey="zip" attributeID="postalCode" />
<uid:ValueMap mongoKey="address1" attributeID="postalAddress" />
</uid:AttributeMap>
</resolver:DataConnector>
<!-- JSON structure for the this example
{ "_id" : ObjectId("4e5bd2d8a7e6b7a04a15ed28"),
"address" : { "address1" : "Example road 10",
"address2" : "",
"city" : "Somewhere",
"country" : "swe",
"zip" : "11111" },
"mail" : "[email protected]",
"username" : "johndoe"
}
-->
3. (Optional) Adding mongodb persistent ID connector
---------------------------------------------------------------------------------------
EXAMPLE 1 (Attribute definition, Mongodb data connector, Mongodb persistent ID connector):
---------------------------------------------------------------------------------------
<!-- Attribute definition -->
<resolver:AttributeDefinition xsi:type="ad:SAML2NameID" id="eduPersonTargetedID"
nameIdFormat="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" sourceAttributeID="persistentID">
<resolver:Dependency ref="myMongo2" />
<resolver:AttributeEncoder xsi:type="enc:SAML1XMLObject" name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" />
<resolver:AttributeEncoder xsi:type="enc:SAML2XMLObject" name="urn:oid:1.3.6.1.4.1.5923.1.1.1.10" friendlyName="eduPersonTargetedID" />
</resolver:AttributeDefinition>
<!-- Mongodb data connector -->
<resolver:DataConnector id="myMongo" xsi:type="uid:MongoDbDataConnector"
mongoDbName="idp"
mongoCollection="users">
<uid:MongoHost host="server1.example.com" port="27017" />
<uid:MongoHost host="server2.example.com" port="27017" />
<uid:MongoHost host="server3.example.com" port="27017" />
<uid:QueryTemplate>
<![CDATA[
{ 'userName' : '$requestContext.principalName' }
]]>
</uid:QueryTemplate>
<uid:AttributeMap mongoKey="userName" attributeID="uid" />
</resolver:DataConnector>
<!-- Mongodb persistent ID connector -->
<resolver:DataConnector id="myMongo2" xsi:type="uid:MongoDbDataConnector"
mongoDbName="idp"
mongoCollection="shibpid">
<!-- Resolver dependency needed to resolve uid in sourceAttributeId -->
<resolver:Dependency ref="myMongo" />
<uid:MongoHost host="server1.example.com" port="27017" />
<uid:MongoHost host="server2.example.com" port="27017" />
<uid:MongoHost host="server3.example.com" port="27017" />
<uid:PersistentId generatedAttributeId="persistentID"
sourceAttributeId="uid" />
</resolver:DataConnector>
NOTE:
----
a. QueryTemplate is in JSON format