...
Table of Contents | ||||
---|---|---|---|---|
|
Sharing the user store
First, Initially, configure your user store(s), if you have not done so already, by following the instructions in Configuring User Stores. Thereafter, point both WSO2 IS Identity Server and WSO2 API Manager to a single user store your user stores(s) using the instructions given in section Configuring User Storesbelow. You do this to make sure that a user who tries to log in to the the API Manager console, the API Store or the Publisher is is authorized. When a user tries to log in to either of the three applications, s/he is redirected to the configured identity provider (WSO2 IS in this case) where s/he provides the login credentials to be authenticated. In addition to this, the user should also be authorized by the system as some user roles do not have permission to perform certain actions. For the purpose of authorization, the IS and API Manager need to have a shared user store and user management database (by default, this is the H2 database in the <APIM_HOME>/repository/conf/user-mgt.xml
file) where the user's role and permissions are stored.
For example, let let's take share a common JDBC user store (MySQL) for with both the WSO2 IS and Identity Server and WSO2 API Manager as follows:
Download WSO2 API Manager 1.10.0 from here and unzip it.
<APIM_HOME>
refers to the root folder where WSO2 APIM was unzipped.Create a MySQL database (e.g.,
410_um_db
) and run the<APIM_HOME>/dbscripts/mysql.sql
script on it to create the required tables.
If you are using a different database type, find the relevant script from the<APIM_HOME>/dbscripts
directory.Open the
<APIM_HOME>/repository/conf/datasources/master-datasources.xml
file and add the datasource configuration for the database that you use for the shared user store and user management information. For example,Code Block <datasource>language html/xml For example, you can share as single user store as follows. If you are sharing multiple datasources, you need to define a datasource for each of the user stores that you are working with, so that they can be shared.
Code Block title Example <datasource> <name>WSO2_UM_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2UMDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/410_um_db</url> <username>username</username> <password>password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
Add the same datasource configuration above to
<IS_HOME>/repository/conf/datasources/master-datasources.xml
file.Copy the database driver JAR file to the
<IS_HOME>/repository/components/lib
and<APIM_HOME>/repository/components/lib
directories.Open the <APIMDownload WSO2 Identity Server (WSO2 IS) 5.1.0 from here and unzip it.
<IS_HOME>
refers to the root folder where WSO2 IS was unzipped.Tip If you plan on using WSO2 IS as Key Manager as well, you can download the WSO2 Identity Server 5.1.0 as a Key Manager pack, which has Key Manager features pre-packaged with WSO2 IS, from here.
Add the same datasource configuration above to
<IS_HOME>/repository/conf/datasources/
usermaster-
mgtdatasources.xml
file. TheCopy the database driver JAR file to the
<IS_HOME>/repository/components/lib
and<APIM_HOME>/repository/components/lib
directories.Open the
<APIM_HOME>/repository/conf/user-mgt.xml
file. ThedataSource
property points to the default H2 database. Change it to the jndiConfig name given above (i.e.,jdbc/WSO2UMDB
). This changes the datasource reference that is pointing to the default H2 database.Code Block language html/xml <Realm> <Configuration> ... <Property name="dataSource">jdbc/WSO2UMDB</Property> </Configuration> ... </Realm>
- Add the same configuration above to the
<IS_HOME>/repository/conf/user-mgt.xml
file. The Identity Server has an embedded LDAP user store by default. As this is enabled by default, follow the instructions in Internal JDBC User Store Configuration to disable the default LDAP and enable the JDBC user store instead.
...
Configuring WSO2 Identity Server as a SAML 2.0 SSO Identity Provider
...
.0 SSO Identity Provider
Start the WSO2 Identity Server.
Code Block ./wso2server.sh -DportOffset=1
Info title What is port offset? The port offset feature allows you to run multiple WSO2 products, multiple instances of a WSO2 product, or multiple WSO2 product clusters on the same server or virtual machine (VM). The port offset defines the number by which all ports defined in the runtime, such as the HTTP/S ports, will be offset. For example, if the HTTPS port is defined as 9443 and the portOffset is 1, the effective HTTPS port will be 9444.
Sign in to the WSO2 IS Management Console UI (
https://localhost:9443/carbon).
Tip If you use login signin pages that are hosted externally to log sign in to the Identity Server, give the absolute URLs of those login pages in the
authenticators.xml
andapplication-authenticators.xml
files in the<IS_HOME>/repository/conf/identity
directory.- Select Add under Service Providers menu.
Give a service provider name and click Register.
Tip In a multi tenanted environment, for all tenants to be able to log in to the APIM Web applications, do the following:
Click the SaaS Application option that appears after registering the service provider.
If not, only users in the current tenant domain (the one you are defining the service provider in) will be allowed to log in to the Web application and you have to register new service providers for all Web applications (API Store and API Publisher in this case) from each tenant space separately. For example, let's say you have three tenants as TA, TB and TC and you register the service provider in TA only. If you tick the SaaS Application option, all users in TA, TB, TC tenant domains will be able to log in. Else, only users in TA will be able to log in.Add the following inside the
<SSOService>
element in the<IS_HOME>/repository/conf/identity/identity.xml
file and restart the server.Code Block <SSOService> <UseAuthenticatedUserDomainCrypto>true</UseAuthenticatedUserDomainCrypto> ... </SSOService>
If not, you get an exception as SAML response signature verification fails.
- Because the servers in a multi-tenanted environment interact with all tenants, all nodes should share the same user store. Therefore, make sure you have a shared registry (JDBC mount, WSO2 Governance Registry etc.) instance across all nodes.
You are navigated to the detailed configuration page. Expand SAML2 Web SSO Configuration inside the Inbound Authentication Configuration section. Click Configure.
Provide the configurations to register the API Publisher as the SSO service provider. These sample values may change depending in your configuration.
- Issuer : API_PUBLISHER
- Assertion Consumer URL : https://localhost:9443/publisher/jagg/jaggery_acs.jag. Change the IP and port accordingly. This is the URL for the acs page in your running publisher app.
Select the following options:
Use fully qualified username in the NameIDEnable Response Signing
Enable Signature Validation in Authentication Requests and Logout Requests
Enable Assertion SigningEncryption
Enable Single Logout
- Click Register once done.
For example:
Similarly, provide the configurations to register the API Store as the SSO service provider. These sample values may change depending in your configuration.
- Issuer : API_STORE
- Assertion Consumer URL : https://localhost:9443/store/jagg/jaggery_acs.jag. Change the IP and port accordingly. This is the URL for the acs page in your running store app.
- Select the following options:
- Use fully qualified username in the NameID Enable Response Signing Enable Response Signing
- Enable Signature Validation in Authentication Requests and Logout Requests
- Enable Assertion Signing Encryption
- Enable Single Logout
- Click Register once done.
Tip |
---|
For more information on SAML related terminologies discussed in the sections above, go to Assertions and Protocols for the OASIS SAML 2.0 documentation. |
- Make sure that the
responseSigningEnabled
element is set totrue
in both the following files:<APIM_HOME>/repository/deployment/server/jaggeryapps/publisher/site/conf/site.json
<APIM_HOME>/repository/deployment/server/jaggeryapps/store/site/conf/site.json
Info For more details on configuring WSO2 Identity Server 5.1.0 see, Configuring the service provider.
Configuring WSO2 API Manager apps as SAML 2.0 SSO service providers
...
To disable the passive mode, set the property named passive
to false in the <API_M <APIM_HOME>/repository/deployment/server/jaggeryapps/store/site/conf/site.json
file.
Code Block |
---|
"ssoConfiguration" : { ... "passive" : "true", ... }, |