提交 5e89af53 编写于 作者: 智布道's avatar 智布道 👁

Merge branch 'master' into dev

# Conflicts:
#	jap-core/src/test/java/com/fujieid/jap/core/context/JapAuthenticationTest.java
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Publish Snapshot
on:
workflow_dispatch:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# 安装JDK环境
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 1.8
server-id: sonatype-nexus-snapshots # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to GitHub Packages Apache Maven
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
......@@ -2,8 +2,27 @@
### New features
- **Complete the development of the `jap-ids` module, and provide oauth services externally based on `jap-ids`**
- Add `com.fujieid.jap.core.util.RequestUtil`
- **Complete the development of the `jap-ids` module, and provide oauth services externally based on `jap-ids`**
- **Supported features**
- Authorization Code Grant
- Proof Key for Code Exchange
- Implicit Grant
- Resource Owner Password Credentials Grant
- Client Credentials Grant
- Refresh access token
- Revoke access token
- Get the currently authorized user
- Verify login status
- Abnormal prompt
- Sign out
- OpenID Connect Discovery
- JWK Endpoint
- Custom jwt encryption and decryption certificate
- Support multiple response types, such as: `code`, `token`, `id token`, `id token token`, `code id token`, `code token`, `code id token token`
- ...
For more details about the use of `jap-ids`, please refer to the sample project: [jap-ids-demo](https://gitee.com/fujieid/jap-ids-demo), or refer to the document: [IDS OAuth 2.0 服务端]( https://justauth.plus/ids/)
### Modified
......@@ -17,6 +36,10 @@
- Merge Gitee PR [#9](https://gitee.com/fujieid/jap/pulls/9) by [@dreamlu](https://gitee.com/dreamlu)
### Issue
- Fix Gitee Issue [#I3DC7N](https://gitee.com/fujieid/jap/issues/I3DC7N)
## v1.0.1-alpha.1(2021-03-07)
### Modified
......
......@@ -155,7 +155,7 @@ public class JwtUtil {
// allow some leeway in validating time based claims to account for clock skew
.setAllowedClockSkewInSeconds(30)
// verify the signature with the public key
// .setVerificationKey(publicJsonWebKey.getPublicKey())
.setVerificationKey(publicJsonWebKey.getPublicKey())
// create the JwtConsumer instance
.build();
......
......@@ -20,7 +20,7 @@ public class OidcUtilTest extends BaseIdsTest {
@Test
public void getOidcDiscoveryInfoEqual() {
OidcDiscoveryDto discoveryDto = OidcUtil.getOidcDiscoveryInfo(null);
Assert.assertEquals("{\"issuer\":\"http://localhost:8080\",\"authorization_endpoint\":\"http://localhost:8080/oauth/authorize\",\"token_endpoint\":\"http://localhost:8080/oauth/token\",\"userinfo_endpoint\":\"http://localhost:8080/oauth/userinfo\",\"registration_endpoint\":\"http://localhost:8080/oauth/registration\",\"end_session_endpoint\":\"http://localhost:8080/oauth/logout\",\"check_session_iframe\":\"http://localhost:8080/oauth/check_session\",\"jwks_uri\":\"http://localhost:8080/.well-known/jwks.json\",\"grant_types_supported\":[\"authorization_code\",\"implicit\",\"password\",\"client_credentials\",\"refresh_token\",\"token\"],\"response_modes_supported\":[\"fragment\",\"query\"],\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"id_token token\",\"code id_token\",\"code token\",\"code id_token token\",\"none\"],\"scopes_supported\":[\"read\",\"write\",\"openid\",\"email\",\"phone\"],\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"client_secret_basic\",\"none\"],\"request_object_signing_alg_values_supported\":[\"none\",\"RS256\",\"ES256\"],\"userinfo_signing_alg_values_supported\":[\"RS256\",\"ES256\"],\"request_parameter_supported\":true,\"request_uri_parameter_supported\":true,\"require_request_uri_registration\":false,\"claims_parameter_supported\":true,\"id_token_signing_alg_values_supported\":[\"RS256\",\"ES256\"],\"subject_types_supported\":[\"public\"],\"claims_supported\":[\"iss\",\"sub\",\"aud\",\"exp\",\"iat\",\"nonce\",\"auth_time\",\"username\"]}", JsonUtil.toJsonString(discoveryDto));
Assert.assertEquals("{\"issuer\":\"http://www.baidu.com\",\"authorization_endpoint\":\"http://www.baidu.com/oauth/authorize\",\"token_endpoint\":\"http://www.baidu.com/oauth/token\",\"userinfo_endpoint\":\"http://www.baidu.com/oauth/userinfo\",\"registration_endpoint\":\"http://www.baidu.com/oauth/registration\",\"end_session_endpoint\":\"http://www.baidu.com/oauth/logout\",\"check_session_iframe\":\"http://www.baidu.com/oauth/check_session\",\"jwks_uri\":\"http://www.baidu.com/.well-known/jwks.json\",\"grant_types_supported\":[\"authorization_code\",\"implicit\",\"password\",\"client_credentials\",\"refresh_token\",\"token\"],\"response_modes_supported\":[\"fragment\",\"query\"],\"response_types_supported\":[\"code\",\"token\",\"id_token\",\"id_token token\",\"code id_token\",\"code token\",\"code id_token token\",\"none\"],\"scopes_supported\":[\"read\",\"write\",\"openid\",\"email\",\"phone\"],\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"client_secret_basic\",\"none\"],\"request_object_signing_alg_values_supported\":[\"none\",\"RS256\",\"ES256\"],\"userinfo_signing_alg_values_supported\":[\"RS256\",\"ES256\"],\"request_parameter_supported\":true,\"request_uri_parameter_supported\":true,\"require_request_uri_registration\":false,\"claims_parameter_supported\":true,\"id_token_signing_alg_values_supported\":[\"RS256\",\"ES256\"],\"subject_types_supported\":[\"public\"],\"claims_supported\":[\"iss\",\"sub\",\"aud\",\"exp\",\"iat\",\"nonce\",\"auth_time\",\"username\"]}", JsonUtil.toJsonString(discoveryDto));
}
@Test
......
......@@ -145,7 +145,7 @@ public class JwtUtilTest extends BaseIdsTest {
@Test
public void parseJwtTokenFromRs256() {
String jwt = "eyJraWQiOiJqYXAtandrLWtleWlkIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwOi8vd3d3Lm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ds.getIdsConfig().getJwtConfig().setJwksJson(rs256JwksJson);
Map<String, Object> jwtInfo = JwtUtil.parseJwtToken(jwt);
System.out.println(jwtInfo);
......
......@@ -71,9 +71,7 @@ public class Oauth2UtilTest {
public void checkOauthResponseNoError() {
Kv kv = new Kv();
String errorMsg = "errorMsg";
Oauth2Util.checkOauthResponse(kv, errorMsg);
Assert.assertThrows(JapOauth2Exception.class, () -> AccessTokenHelper.getToken(httpServletRequestMock, new OAuthConfig()
.setResponseType(Oauth2ResponseType.token)));
Assert.assertThrows(JapOauth2Exception.class, () -> Oauth2Util.checkOauthResponse(kv, errorMsg));
}
@Test
......
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Publish Snapshot
on:
workflow_dispatch:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# 安装JDK环境
- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: 1.8
server-id: sonatype-nexus-snapshots # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Publish to GitHub Packages Apache Maven
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册