suppression du parsing html
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/base64"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
@@ -10,19 +9,12 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
|
templateoauth "github.com/ldrogou/goauth20/templateOAuth"
|
||||||
)
|
)
|
||||||
|
|
||||||
//File structure du fichier
|
|
||||||
type File struct {
|
|
||||||
JwtProduce string
|
|
||||||
Header string
|
|
||||||
Payload string
|
|
||||||
}
|
|
||||||
|
|
||||||
type JsonToken struct {
|
type JsonToken struct {
|
||||||
clientID string `json:"client_id"`
|
clientID string `json:"client_id"`
|
||||||
clientSecret string `json:"client_secret"`
|
clientSecret string `json:"client_secret"`
|
||||||
@@ -53,7 +45,7 @@ func (s *server) handleIndex() http.HandlerFunc {
|
|||||||
rw.Header().Set("Content-Type", "text/html")
|
rw.Header().Set("Content-Type", "text/html")
|
||||||
rw.WriteHeader(http.StatusOK)
|
rw.WriteHeader(http.StatusOK)
|
||||||
|
|
||||||
t, err := template.ParseFiles("template/jwt.html")
|
t, err := template.New("test").Parse(templateoauth.TemplateIndex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("erreur suivante %v", err)
|
fmt.Errorf("erreur suivante %v", err)
|
||||||
}
|
}
|
||||||
@@ -103,25 +95,8 @@ func (s *server) handleLocal() http.HandlerFunc {
|
|||||||
rw.WriteHeader(http.StatusInternalServerError)
|
rw.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tableau := strings.Split(tokenString, ".")
|
|
||||||
header, _ := base64.URLEncoding.DecodeString(tableau[0])
|
|
||||||
log.Println(string(string(header)))
|
|
||||||
|
|
||||||
log.Println(tableau[1])
|
s.responseFile(rw, r, tokenString, http.StatusOK)
|
||||||
payload, _ := base64.URLEncoding.DecodeString(tableau[1])
|
|
||||||
log.Println(string(payload))
|
|
||||||
|
|
||||||
log.Println(tableau[2])
|
|
||||||
test, _ := base64.URLEncoding.DecodeString(tableau[2])
|
|
||||||
log.Println(string(string(test)))
|
|
||||||
|
|
||||||
tokenSssss := map[string]interface{}{
|
|
||||||
"access_token": tokenString,
|
|
||||||
"header": string(header),
|
|
||||||
"payload": string(payload),
|
|
||||||
}
|
|
||||||
|
|
||||||
s.responseFile(rw, r, tokenSssss, http.StatusOK)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -174,7 +149,7 @@ func (s *server) handleRedirect() http.HandlerFunc {
|
|||||||
|
|
||||||
fmt.Println("response Status:", resp.Status)
|
fmt.Println("response Status:", resp.Status)
|
||||||
fmt.Println("response Headers:", resp.Header)
|
fmt.Println("response Headers:", resp.Header)
|
||||||
var t interface{}
|
var t map[string]interface{}
|
||||||
// here's the trick
|
// here's the trick
|
||||||
json.NewDecoder(resp.Body).Decode(&t)
|
json.NewDecoder(resp.Body).Decode(&t)
|
||||||
|
|
||||||
@@ -191,7 +166,7 @@ func (s *server) handleRedirect() http.HandlerFunc {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
s.responseFile(rw, r, t, http.StatusOK)
|
s.responseFile(rw, r, t["access_token"], http.StatusOK)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
45
server.go
45
server.go
@@ -6,8 +6,11 @@ import (
|
|||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/dgrijalva/jwt-go"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
templateoauth "github.com/ldrogou/goauth20/templateOAuth"
|
||||||
)
|
)
|
||||||
|
|
||||||
type server struct {
|
type server struct {
|
||||||
@@ -15,6 +18,14 @@ type server struct {
|
|||||||
store Store
|
store Store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//File structure du fichier
|
||||||
|
type File struct {
|
||||||
|
JwtProduce string
|
||||||
|
Header string
|
||||||
|
Payload string
|
||||||
|
Sign string
|
||||||
|
}
|
||||||
|
|
||||||
func newServer() *server {
|
func newServer() *server {
|
||||||
s := &server{
|
s := &server{
|
||||||
router: mux.NewRouter(),
|
router: mux.NewRouter(),
|
||||||
@@ -42,35 +53,41 @@ func (s *server) response(rw http.ResponseWriter, _ *http.Request, data interfac
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) responseFile(rw http.ResponseWriter, _ *http.Request, data interface{}, status int) {
|
func (s *server) responseFile(rw http.ResponseWriter, _ *http.Request, data interface{}, status int) error {
|
||||||
rw.Header().Set("Content-Type", "text/html")
|
rw.Header().Set("Content-Type", "text/html")
|
||||||
rw.WriteHeader(status)
|
rw.WriteHeader(status)
|
||||||
|
|
||||||
tokenVal := data.(interface{}).(map[string]interface{})
|
tokenVal := data.(string)
|
||||||
|
|
||||||
//t := template.New("mon template")
|
tableau := strings.Split(tokenVal, ".")
|
||||||
tem, err := template.ParseFiles("template/resultat.html")
|
header, err := jwt.DecodeSegment(tableau[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("erreur suivante %v", err)
|
return fmt.Errorf("Impossible de décoder le header. (err=%v)", err)
|
||||||
|
}
|
||||||
|
payload, err := jwt.DecodeSegment(tableau[1])
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Impossible de décoder le payload. (err=%v)", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sssss := tokenVal["access_token"].(string)
|
//t := template.New("mon template")
|
||||||
header := tokenVal["header"].(string)
|
tem, err := template.New("Resulta").Parse(templateoauth.Resultat)
|
||||||
payload := tokenVal["payload"].(string)
|
if err != nil {
|
||||||
//sssss := "erer"
|
return fmt.Errorf("erreur suivante %v", err)
|
||||||
log.Println(sssss)
|
}
|
||||||
|
|
||||||
f := File{
|
f := File{
|
||||||
JwtProduce: sssss,
|
JwtProduce: tokenVal,
|
||||||
Header: header,
|
Header: string(header),
|
||||||
Payload: payload,
|
Payload: string(payload),
|
||||||
|
Sign: tableau[2],
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tem.Execute(rw, f)
|
err = tem.Execute(rw, f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Errorf("erreur suivante %v", err)
|
return fmt.Errorf("erreur suivante %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *server) decode(rw http.ResponseWriter, r *http.Request, v interface{}) error {
|
func (s *server) decode(rw http.ResponseWriter, r *http.Request, v interface{}) error {
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>RCA JWT API</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
|
||||||
|
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha512.js"></script>
|
|
||||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js"></script>
|
|
||||||
<script>
|
|
||||||
|
|
||||||
var payloadJson = `{{.Payload}}`
|
|
||||||
console.log(JSON.stringify(payloadJson))
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<h1 class="center-align">Composition</h1>
|
|
||||||
</div>
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col s5">
|
|
||||||
<span style="width:300px; word-wrap:break-word; display:inline-block;">
|
|
||||||
{{.JwtProduce }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="col s7">
|
|
||||||
header
|
|
||||||
<div>{{.Header}}</div>
|
|
||||||
Payload
|
|
||||||
<div>
|
|
||||||
<span style="width:300px; word-wrap:break-word; display:inline-block;">
|
|
||||||
{{.Payload}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
169
templateOAuth/index.go
Normal file
169
templateOAuth/index.go
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
package templateoauth
|
||||||
|
|
||||||
|
//TemplateIndex index html
|
||||||
|
var TemplateIndex = `<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>RCA JWT API</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||||
|
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha512.js"></script>
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function base64url(source) {
|
||||||
|
// Encode in classical base64
|
||||||
|
encodedSource = CryptoJS.enc.Base64.stringify(source);
|
||||||
|
|
||||||
|
// Remove padding equal characters
|
||||||
|
encodedSource = encodedSource.replace(/=+$/, '');
|
||||||
|
|
||||||
|
// Replace characters according to base64url specifications
|
||||||
|
encodedSource = encodedSource.replace(/\+/g, '-');
|
||||||
|
encodedSource = encodedSource.replace(/\//g, '_');
|
||||||
|
|
||||||
|
return encodedSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateToken(form) {
|
||||||
|
var form = document.getElementById(form);
|
||||||
|
|
||||||
|
form.submit();
|
||||||
|
|
||||||
|
//window.location = 'https://captation.beta.rca.fr/entreprise-partenaire/authorize?client_id=meg-test-interne&scope=user.read company.read accounting_firm.read sales¤t_company=true&redirect_uri=http://localhost:8080/oauth/redirect'
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate() {
|
||||||
|
var header = {
|
||||||
|
"alg": "HS512"
|
||||||
|
};
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
"sub": document.getElementById('sub').value,
|
||||||
|
"exp": Math.floor(Date.now() / 1000) + 6 * 30 * 24 * 3600,
|
||||||
|
"roles": [
|
||||||
|
"RCA_CLOUD_EXPERT_COMPTABLE",
|
||||||
|
"E_COLLECTE_BO_CREA",
|
||||||
|
"E_CREATION_CREA",
|
||||||
|
"E_QUESTIONNAIRE_CREA"
|
||||||
|
],
|
||||||
|
"id_entreprise": document.getElementById('id_entreprise').value,
|
||||||
|
"rcaPartnerId": document.getElementById('rcaPartnerId').value
|
||||||
|
};
|
||||||
|
|
||||||
|
var secret = document.getElementById('secret').value;
|
||||||
|
secret = CryptoJS.enc.Base64.parse(secret);
|
||||||
|
|
||||||
|
var stringifiedHeader = CryptoJS.enc.Utf8.parse(JSON.stringify(header));
|
||||||
|
var encodedHeader = base64url(stringifiedHeader);
|
||||||
|
|
||||||
|
var stringifiedData = CryptoJS.enc.Utf8.parse(JSON.stringify(data));
|
||||||
|
var encodedData = base64url(stringifiedData);
|
||||||
|
|
||||||
|
var signature = encodedHeader + "." + encodedData;
|
||||||
|
signature = CryptoJS.HmacSHA512(signature, secret);
|
||||||
|
signature = base64url(signature);
|
||||||
|
|
||||||
|
document.getElementById('jwt').value = encodedHeader + "." + encodedData + "." + signature;
|
||||||
|
M.updateTextFields();
|
||||||
|
M.textareaAutoResize(document.getElementById('jwt'));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1 class="center-align">JWT</h1>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<form class="col s6 light-blue lighten-5" id="formLocal" method="post" action="/local">
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_circle</i>
|
||||||
|
<input type="text" id="sub" name="sub" value="mbola.randriamamonjisoa+ec@rca.fr">
|
||||||
|
<label for="name">Subject :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_balance</i>
|
||||||
|
<input type="text" id="id_entreprise" name="id_entreprise" value="85422">
|
||||||
|
<label for="name">Id entreprise :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_balance</i>
|
||||||
|
<input type="text" id="rcaPartnerId" name="rcaPartnerId" value="agora-expert">
|
||||||
|
<label for="name" >ID partenaire RCA :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">fiber_pin</i>
|
||||||
|
<input type="text" id="secret" name="secret" value="XXXXXXX">
|
||||||
|
<label for="name">Secret :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<a class="waves-effect waves-light btn" onclick="generateToken('formLocal');"><i
|
||||||
|
class="material-icons left">cloud</i>Local</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form class="col s6 light-green lighten-5" id="formOAtuh20" method="post" action="/oauth20">
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_balance</i>
|
||||||
|
<input type="text" id="domain" name="domain" value="captation.beta.rca.fr">
|
||||||
|
<label for="name">Domaine :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_balance</i>
|
||||||
|
<input type="text" id="clientId" name="clientId" value="meg-test-interne">
|
||||||
|
<label for="name">Client Id :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_balance</i>
|
||||||
|
<input type="text" id="clientSecret" name="clientSecret" value="xxxxxxxx">
|
||||||
|
<label for="name">Client Secret :</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="input-field col s12">
|
||||||
|
<i class="material-icons prefix">account_balance</i>
|
||||||
|
<input type="text" id="scopes" name="scopes" value="user">
|
||||||
|
<label for="name">Scopes</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="checkbox col s12">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="currentCompany" name="currentCompany" checked="checked" />
|
||||||
|
<span>Company courante</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<a class="waves-effect waves-light btn" onclick="generateToken('formOAtuh20');"><i
|
||||||
|
class="material-icons left">cloud</i>OAuth2.0</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>`
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
<div class="input-field col s12">
|
<div class="input-field col s12">
|
||||||
<i class="material-icons prefix">account_balance</i>
|
<i class="material-icons prefix">account_balance</i>
|
||||||
<input type="text" id="rcaPartnerId" name="rcaPartnerId" value="agora-expert">
|
<input type="text" id="rcaPartnerId" name="rcaPartnerId" value="agora-expert">
|
||||||
<label for="name">ID partenaire RCA :</label>
|
<label for="name" >ID partenaire RCA :</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
69
templateOAuth/resultat.go
Normal file
69
templateOAuth/resultat.go
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
package templateoauth
|
||||||
|
|
||||||
|
//Resultat page de resultat
|
||||||
|
var Resultat = `<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>RCA JWT API</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||||
|
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha512.js"></script>
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1 class="center-align">Composition</h1>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="light-blue lighten-5 col s5">
|
||||||
|
<span style="width:300px; word-wrap:break-word; display:inline-block;">
|
||||||
|
{{.JwtProduce }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col s7">
|
||||||
|
|
||||||
|
<ul class="collapsible collapsible-accordion">
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">filter_drama</i>header</div>
|
||||||
|
<div class="collapsible-body" ><pre id="header"></pre></div>
|
||||||
|
</li>
|
||||||
|
<li class="active">
|
||||||
|
<div class="collapsible-header"><i class="material-icons">place</i>payload</div>
|
||||||
|
<div class="collapsible-body"><pre id="payload"></pre></div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">whatshot</i>signature</div>
|
||||||
|
<div class="collapsible-body"><span>{{.Sign}}</span></div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
let headerGO = JSON.parse('{{.Header}}')
|
||||||
|
let payloadGo = JSON.parse('{{.Payload}}')
|
||||||
|
var headerJson = JSON.stringify(headerGO, null, 4)
|
||||||
|
var payloadJson = JSON.stringify(payloadGo, null, 4)
|
||||||
|
document.getElementById("header").innerHTML = "<pre>" + headerJson + "</pre>"
|
||||||
|
document.getElementById("payload").innerHTML = "<pre>" + payloadJson + "</pre>"
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
var elems = document.querySelectorAll('.collapsible');
|
||||||
|
var instances = M.Collapsible.init(elems, {});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>`
|
||||||
66
templateOAuth/resultat.html
Normal file
66
templateOAuth/resultat.html
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>RCA JWT API</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
||||||
|
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha512.js"></script>
|
||||||
|
<script src="http://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1 class="center-align">Composition</h1>
|
||||||
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="light-blue lighten-5 col s5">
|
||||||
|
<span style="width:300px; word-wrap:break-word; display:inline-block;">
|
||||||
|
{{.JwtProduce }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col s7">
|
||||||
|
|
||||||
|
<ul class="collapsible collapsible-accordion">
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">filter_drama</i>header</div>
|
||||||
|
<div class="collapsible-body" ><pre id="header"></pre></div>
|
||||||
|
</li>
|
||||||
|
<li class="active">
|
||||||
|
<div class="collapsible-header"><i class="material-icons">place</i>payload</div>
|
||||||
|
<div class="collapsible-body"><pre id="payload"></pre></div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header"><i class="material-icons">whatshot</i>signature</div>
|
||||||
|
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
let headerGO = JSON.parse('{{.Header}}')
|
||||||
|
let payloadGo = JSON.parse('{{.Payload}}')
|
||||||
|
var headerJson = JSON.stringify(headerGO, null, 4)
|
||||||
|
var payloadJson = JSON.stringify(payloadGo, null, 4)
|
||||||
|
document.getElementById("header").innerHTML = "<pre>" + headerJson + "</pre>"
|
||||||
|
document.getElementById("payload").innerHTML = "<pre>" + payloadJson + "</pre>"
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
var elems = document.querySelectorAll('.collapsible');
|
||||||
|
var instances = M.Collapsible.init(elems, {});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user