From b8392ae3b1cdd96362b766d6442027dbcf070031 Mon Sep 17 00:00:00 2001 From: shimingxy Date: Thu, 12 Mar 2020 14:43:38 +0800 Subject: [PATCH] u --- _config.yml | 1 - docs/sso/jwt.md | 177 +----------------------------------------------- 2 files changed, 2 insertions(+), 176 deletions(-) delete mode 100644 _config.yml diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c4192631f..000000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/docs/sso/jwt.md b/docs/sso/jwt.md index 834669811..3ce034ca7 100644 --- a/docs/sso/jwt.md +++ b/docs/sso/jwt.md @@ -13,182 +13,9 @@ jar包依赖如下 -commons-codec-1.9.jar - -commons-io-2.2.jar - -commons-logging-1.1.1.jar - -gson-2.2.4.jar - -json-smart-2.3.jar - -log4j-1.2.17.jar - -maxkey-client-sdk.jar - -nimbus-jose-jwt-8.8.jar - -jcip-annotations-1.0.jar - -asm-1.0.2.jar +https://github.com/shimingxy/MaxKey-Demo/tree/master/maxkey-demo-jwt/lib JSP实现Code -
 
-<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
-<%@ page language="java" import="org.maxkey.client.oauth.oauth.*" %>
-<%@ page language="java" import="org.maxkey.client.oauth.builder.*" %>
-<%@ page language="java" import="org.maxkey.client.oauth.builder.api.ConnsecApi20" %>
-<%@ page language="java" import="org.maxkey.client.oauth.model.*" %>
-<%@ page language="java" import="org.maxkey.client.utils.*" %>
-<%@ page language="java" import="com.nimbusds.jwt.JWTClaimsSet" %>
-<%@ page language="java" import="com.nimbusds.jose.*" %>
-<%@ page language="java" import="com.nimbusds.jwt.*" %>
-<%@ page language="java" import="com.connsec.oidc.jose.keystore.*" %>
-<%@ page language="java" import="com.nimbusds.jose.jwk.*" %>
-<%@ page language="java" import="java.io.File" %>
-<%@ page language="java" import="com.nimbusds.jose.crypto.*" %>
-<%@ page language="java" import="com.google.gson.*" %>
-
-
-
-<%
-String path = request.getContextPath();
-String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
-String token=request.getParameter("jwt");
-System.out.println("jwt "+token);
-SignedJWT signedJWT=null;
-
-//JWKSetKeyStore jwkSetKeyStore=new JWKSetKeyStore();
-
-File jwksFile=new File(PathUtils.getInstance().getClassPath()+"jwk.jwks");
-JWKSet jwkSet=JWKSet.load(jwksFile);
-
-RSASSAVerifier rsaSSAVerifier = new RSASSAVerifier(((RSAKey) jwkSet.getKeyByKeyId("maxkey_rsa")).toRSAPublicKey());
-try {
-
-    signedJWT = SignedJWT.parse(token);
-} catch (java.text.ParseException e) {
-    // Invalid signed JWT encoding
-}
-
-System.out.println("signedJWT "+signedJWT);
-JWTClaimsSet jwtClaims =signedJWT.getJWTClaimsSet();
- 
-%>
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <base href="<%=basePath%>">
-    
-   <title>JWT 1.0 Demo</title>
-	<meta http-equiv="pragma" content="no-cache">
-	<meta http-equiv="cache-control" content="no-cache">
-	<meta http-equiv="expires" content="0">    
-	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
-	<meta http-equiv="description" content="JWT 1.0 Demo">
-	<link rel="shortcut icon" type="image/x-icon" href="<%=basePath %>/images/favicon.ico"/>
-	
-	<style type="text/css">
-		body{
-			margin: 0;
-			margin-top: 0px;
-			margin-left: auto;
-			margin-right: auto;
-			padding: 0 0 0 0px;
-			font-size: 12px;
-			text-align:center;
-			float:center;
-			font-family: "Arial", "Helvetica", "Verdana", "sans-serif";
-		}
-		.container {
-			width: 990px;
-			margin-left: auto;
-			margin-right: auto;
-			padding: 0 10px
-		}
-		table.datatable {
-			border: 1px solid #d8dcdf;
-			border-collapse:collapse;
-			border-spacing:0;
-			width: 100%;
-			table-layout:fixed;
-		}
-		
-		table.datatable th{
-			border: 1px solid #d8dcdf;
-			border-collapse:collapse;
-			border-spacing:0;
-			height: 40px;
-		}
-		
-		
-		table.datatable td{
-			border: 1px solid #d8dcdf;
-			border-collapse:collapse;
-			border-spacing:0;
-			height: 40px;
-		}
-		
-		table.datatable td.title{
-			text-align: center;
-			font-size: 20px;
-			font-weight: bold;
-		}
-	</style>
-  </head>
-  
-  <body>
-  		<div class="container">
-	  		<table class="datatable">
-	  			<tr>
-	  				
-	  				<td colspan="2" class="title">JSON Web Token (JWT) 1.0 Demo</td>
-	  			</tr>
-	  			
-	  			<tr>
-	  				<td>JWT 1.0 Logo</td>
-	  				<td> <img src="<%=basePath %>/images/jwt.png"  width="124px" height="124px"/></td>
-	  			</tr>
-	  			<tr>
-	  				<td>Issuer</td>
-	  				<td><%=jwtClaims.getIssuer() %></td>
-	  			</tr>
-	  			<tr>
-	  				<td>Subject</td>
-	  				<td><%=jwtClaims.getSubject()%></td>
-	  			</tr>
-	  			<tr>
-	  				<td>Audience</td>
-	  				<td><%=jwtClaims.getAudience() %></td>
-	  			</tr>
-	  			
-	  			<tr>
-	  				<td>ExpirationTime</td>
-	  				<td><%=jwtClaims.getExpirationTime() %></td>
-	  			</tr>
-	  			<tr>
-	  				<td>JWTID</td>
-	  				<td style="word-wrap: break-word;"><%=jwtClaims.getJWTID() %></td>
-	  			</tr>
-	  			<tr>
-	  				<td>IssueTime</td>
-	  				<td style="word-wrap: break-word;"><%=jwtClaims.getIssueTime() %></td>
-	  			</tr>
-	  			<tr>
-	  				<td>JWTClaims</td>
-	  				<td style="word-wrap: break-word;"><%=signedJWT.getPayload() %></td>
-	  			</tr>
-	  			<tr>
-	  				<td>Verify</td>
-	  				<td style="word-wrap: break-word;"><%=signedJWT.verify(rsaSSAVerifier) %></td>
-	  			</tr>
-	  		</table>
-  		</div> 
-  </body>
-</html>
-
- +https://github.com/shimingxy/MaxKey-Demo/blob/master/maxkey-demo-jwt/src/main/webapp/jwtcallback.jsp