# DEPRECATION NOTICE
This repository is deprecated and all the work has been moved to the following repositories.
- https://github.com/asgardio/asgardio-java-saml-sdk.
- https://github.com/asgardio/asgardio-tomcat-saml-agent.
- https://github.com/asgardio/asgardio-java-oidc-sdk.
- https://github.com/asgardio/asgardio-tomcat-oidc-agent.
# WSO2 SAML SDK for Java
The WSO2 SAML SDK for Java enables software developers to integrate SAML based SSO authentication with Java Web
applications. The SDK is built on top of the OpenSAML library which allows Java developers to develop cross-domain
single sign-on and federated access control solutions with minimum hassle.
## Table of Contents
- [Trying out the sample](#trying-out-the-sample)
* [Prerequisites](#prerequisites)
* [Running the SampleApp](#running-the-sampleapp)
- [How it works](#how-it-works)
- [Integrating SAML into your Java application](#integrating-saml-into-your-java-application)
* [Getting Started](#getting-started)
* [Configuring the web app](#configuring-the-web-app)
* [Retrieving User Attributes](#retrieving-user-attributes)
- [Installing the SDK](#installing-the-sdk)
* [Github](#github)
* [Building from the source](#building-from-the-source)
* [Maven](#maven)
- [Contributing](#contributing)
* [Reporting Issues](#reporting-issues)
- [Versioning](#versioning)
- [Authors](#authors)
- [License](#license)
## Trying out the sample
### Prerequisites
1. WSO2 Identity Server and it's [prerequisites](https://is.docs.wso2.com/en/next/setup/installing-the-product/).
2. We assume you are going to use [Maven](https://maven.apache.org/guides/getting-started/) to handle enterprise level
Java projects development. Hence, we will be using [Maven](https://maven.apache.org/guides/getting-started/) for
demonstration.
A sample app for demonstrating SAML based SSO authentication, SLO and attribute retrieval is hosted at:
https://github.com/wso2-extensions/identity-agent-sso/tree/master/resources/SampleApp
You can download the pre-built SampleApp.war from https://github.com/wso2-extensions/identity-agent-sso/releases/latest
### Running the SampleApp
In order to check SSO using SAML2, please follow these steps
1. Start the WSO2 IS.
2. Access WSO2 IS management console and create a service provider (ex:- sampleApp)
For the service provider, configure SAML2 Web SSO under Inbound Authentication Configuration. In this configuration,
use following parameters and options,
Issuer - SampleApp
Assertion Consumer URLs - http://localhost:8080/SampleApp/home.jsp
Enable Attribute Profile - True
Include Attributes in the Response Always - True
Keep other default settings as it is and save the configuration.
Next, expand the [Claim Configuration](https://is.docs.wso2.com/en/latest/learn/configuring-claims-for-a-service-provider/#configuring-claims-for-a-service-provider) section. In this configuration, Set the following config and add the claims you
need to retrieve (ex: http://wso2.org/claims/lastname) from the web app.
Select Claim mapping Dialect - Use Local Claim Dialect
See the example claim config below.
![Claim Config](https://user-images.githubusercontent.com/15249242/90488235-38d45580-e159-11ea-8beb-52d6b5c35034.png)
3. Deploy the application, `SampleApp.war` using Apache Tomcat.
4. Try out the application by accessing the `http://localhost:8080/SampleApp/index.html`.
By default, the application runs on url `http://localhost:8080/SampleApp/`
![Recordit GIF](http://g.recordit.co/IvrtWnDnZ8.gif)
**NOTE:** Some browsers do not support cookie creation for naked host names (ex:- localhost). SSO functionality
require cookies
in the browser.
In that case, use `localhost.com` host name for the sample application. You will require to edit the SampleApp
.properties file in <TOMCAT_HOME>/webapps/SampleApp/WEB-INF/classes directory and set the following:
`SAML2.AssertionConsumerURL=http://localhost.com:8080/SampleApp/home.jsp`
and update the Assertion Consumer URLs in the Identity Server Service Provider configurations accordingly.
You will also require to add this entry
to `hosts` file. For windows this file locations is at `<Windows-Installation-Drive>\Windows\System32\drivers\etc
\hosts`.
For Linux/Mac OS, this file location is at `/etc/hosts`.
## How it works
In the SampleApp sample, we have two pages. A landing page (index.html) which we have not secured, and a secondary
page (home.jsp) which we have secured.
In the SampleApp.properties file in the `identity-agent-sso/resources/SampleApp/src/main/resources` directory, we
have set the /SampleApp/index.html as the index page via the following property:
IndexPage=/SampleApp/index.html
Hence, the sso agent regards the index.html page as the landing page and would be added to the skipURIs. Then, the
index page would be regarded as a page that is not secured.
When a SLO sequence is initiated, the sso agent would redirect the user to this exact page which is configured via
the `IndexPage` property.
In the **index.html** page of the SampleApp, we have added the action for the login button to trigger a SAML
authentication:
`<form method="post" action="samlsso?SAML2.HTTPBinding=HTTP-POST">`
This would engage the SAML2SSOAgentFilter which is specified in the **web.xml** file in the `identity-agent-sso
/resources/SampleApp/src/main/webapp/WEB-INF` directory, and redirect the user to the IdP authentication page.
Upon successful authentication, the user would be redirected to the **home.jsp** page.
In the **home.jsp** file, we have added the following to trigger a SLO flow:
``<a href="logout?SAML2.HTTPBinding=HTTP-POST">Logout</a>``
Clicking on the logout link would trigger the SLO flow engaging the same filter mentioned above. The user would be
redirected to the page configured via the `IndexPage` property previously discussed.
## Integrating SAML into your Java application
### Getting Started
These instructions will guide you on integrating SAML into your Java application with the WSO2 SAML SDK.
This allows the developers to turn a Java application into a SP (Service Provider) that can be connected to an IdP
(Identity Provider) which can support the following main features among many others.
- Single Sign-On (SSO) and Single Log-Out (SLO) (SP-Initiated and IdP-Initiated).
- Assertion and nameID encryption.
- Assertion signatures.
- Message signatures: AuthNRequest, LogoutRequest, LogoutResponses.
- Enable an Assertion Consumer Service endpoint.
- Enable a Single Logout Service endpoint.
- Publish the SP metadata.
A sample application boilerplate is included in https://github.com/wso2-extensions/identity-agent-sso/tree/master/resources/SampleApp-boilerplate which we would use for the following section.
The structure of the web app boilerplate would be as follows:
[![INSERT YOUR GRAPHIC HERE](https://miro.medium.com/max/1400/1*M9-eI8gcUugJD_6u7PXN1Q.png)]()
### Configuring the web app
1. Starting with the pom.xml, the following dependencies should be added for the webApp to be using the SAML SDK.
Install it as a maven dependency:
```
<dependency>
<groupId>org.wso2.carbon.identity.agent.sso.java</groupId>
<artifactId>org.wso2.carbon.identity.sso.tomcat.server</artifactId>
<version>5.5.5</version>
</dependency>
```
The SDK is hosted at the WSO2 Internal Repository. Point to the repository as follows:
```
<repositories>
<repository>
<id>wso2.releases</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
</repositories>
```
2. Next, the webapp itself has two pages, index.html and home.jsp, and a web.xml file.
The index.html contain
没有合适的资源?快使用搜索试试~ 我知道了~
java二次开发源码下载-identity-agent-sso:身份代理sso
共90个文件
java:65个
xml:10个
md:4个
需积分: 5 0 下载量 52 浏览量
2024-05-10
11:38:35
上传
评论
收藏 266KB ZIP 举报
温馨提示
springmvcjava二次开发源码下载弃用通知 此存储库已弃用,所有工作已移至以下存储库。 . . . . 适用于 Java 的 WSO2 SAML SDK WSO2 SAML SDK for Java 使软件开发人员能够将基于 SAML 的 SSO 身份验证与 Java Web 应用程序集成。 SDK 建立在 OpenSAML 库之上,它允许 Java 开发人员以最少的麻烦开发跨域单点登录和联合访问控制解决方案。 目录 试用样品 先决条件 WSO2 身份服务器,它是 . 我们假设您将使用来处理企业级 Java 项目的开发。 因此,我们将用于演示。 用于演示基于 SAML 的 SSO 身份验证、SLO 和属性检索的示例应用托管在: 您可以从以下位置下载预先构建的 SampleApp.war 运行示例应用程序 为了使用 SAML2 检查 SSO,请按照以下步骤操作 启动 WSO2 IS。 访问 WSO2 IS 管理控制台并创建服务提供者(例如:- sampleApp) 对于服务提供商,在入站身份验证配置下配置 SAML2 Web SSO。 在此配置中,使用以下参数和选项, Issue
资源推荐
资源详情
资源评论
收起资源包目录
identity-agent-sso-master - 副本 (2).zip (90个子文件)
identity-agent-sso-master
features
etc
feature.properties 11KB
org.wso2.carbon.identity.sso.agent.server.feature
pom.xml 5KB
.travis.yml 111B
pom.xml 16KB
.github
PULL_REQUEST_TEMPLATE.md 3KB
resources
SampleApp
pom.xml 3KB
src
main
resources
wso2carbon.jks 97KB
sampleApp.properties 2KB
webapp
WEB-INF
web.xml 2KB
home.jsp 3KB
index.html 2KB
SampleApp-boilerplate
pom.xml 2KB
src
main
webapp
WEB-INF
web.xml 768B
home.jsp 2KB
index.html 2KB
LICENSE 11KB
pull_request_template.md 3KB
components
org.wso2.carbon.identity.sso.encryptor
pom.xml 2KB
src
main
java
org
wso2
carbon
identity
sso
encryptor
Encryption.java 5KB
EncryptingException.java 995B
org.wso2.carbon.identity.sso.agent.saml
pom.xml 8KB
src
main
java
org
wso2
carbon
identity
sso
agent
saml
security
SSOAgentCarbonX509Credential.java 4KB
SSOAgentX509KeyStoreCredential.java 5KB
X509CredentialImpl.java 3KB
SSOAgentKeyStoreCredential.java 3KB
SSOAgentX509Credential.java 1KB
SSOAgentCredential.java 1KB
AESDecryptor.java 3KB
internal
SSOAgentServiceComponent.java 3KB
artifact
SAMLSSOSoapMessageService.java 7KB
SAMLSSOArtifactResolutionService.java 12KB
exception
InvalidSessionException.java 1KB
SSOAgentException.java 1KB
ArtifactResolutionException.java 1KB
util
SSOAgentUtils.java 17KB
SSOAgentFilterUtils.java 2KB
SSOAgentDataHolder.java 1KB
SSOAgentRequestResolver.java 3KB
SSOAgentConfigs.java 19KB
SSOAgentConstants.java 5KB
SAML2SSOManager.java 50KB
session
management
SSOAgentSessionManager.java 3KB
SSOAgentHttpSessionListener.java 2KB
bean
SSOAgentConfig.java 32KB
SSOAgentSessionBean.java 5KB
LoggedInSessionBean.java 7KB
SAMLSignatureValidator.java 1KB
org.wso2.carbon.identity.sso.agent
pom.xml 8KB
src
main
java
org
wso2
carbon
identity
sso
agent
SSOAgentContextEventListener.java 4KB
openid
OpenIDManager.java 11KB
AttributesRequestor.java 1010B
security
SSOAgentCarbonX509Credential.java 4KB
SSOAgentX509KeyStoreCredential.java 5KB
X509CredentialImpl.java 3KB
SSOAgentKeyStoreCredential.java 3KB
SSOAgentX509Credential.java 1KB
SSOAgentCredential.java 1KB
AESDecryptor.java 3KB
OpenIdSSOAgentFilter.java 4KB
saml
artifact
SAMLSSOSoapMessageService.java 7KB
SAMLSSOArtifactResolutionService.java 12KB
SAML2SSOManager.java 50KB
SAMLSignatureValidator.java 1KB
internal
SSOAgentServiceComponent.java 3KB
oauth2
SAML2GrantManager.java 5KB
SAML2GrantAccessTokenRequestor.java 5KB
exception
InvalidSessionException.java 1KB
SSOAgentException.java 1KB
ArtifactResolutionException.java 1KB
SSOAgentConstants.java 5KB
OIDCSSOAgentFilter.java 901B
SAML2SSOAgentFilter.java 8KB
util
SSOAgentUtils.java 17KB
SSOAgentFilterUtils.java 2KB
SSOAgentDataHolder.java 2KB
SSOAgentRequestResolver.java 5KB
SSOAgentConfigs.java 26KB
SSOAgentConstants.java 7KB
session
management
SSOAgentSessionManager.java 3KB
SSOAgentHttpSessionListener.java 2KB
bean
SSOAgentConfig.java 42KB
SSOAgentSessionBean.java 6KB
LoggedInSessionBean.java 8KB
org.wso2.carbon.identity.sso.tomcat.server
pom.xml 3KB
src
main
java
org
wso2
carbon
identity
sso
tomcat
server
SSOAgentContextEventListener.java 4KB
SAML2SSOAgentFilter.java 8KB
issue_template.md 823B
.gitignore 299B
README.md 17KB
新建文本文档 (2).txt 2B
共 90 条
- 1
资源评论
2401_84572204
- 粉丝: 84
- 资源: 89
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功