changement de port d'écoute et ajout des scopes
This commit is contained in:
@@ -16,64 +16,12 @@ var TemplateIndex = `<!DOCTYPE html>
|
||||
<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>
|
||||
|
||||
@@ -87,21 +35,35 @@ var TemplateIndex = `<!DOCTYPE html>
|
||||
<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">
|
||||
<input type="text" id="sub" name="sub" value="localhost+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">
|
||||
<input type="text" id="id_entreprise" name="id_entreprise" value="1">
|
||||
<label for="name">Id entreprise :</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
<i class="material-icons prefix">fiber_pin</i>
|
||||
<input type="text" id="scopes" name="scopes" value="purchase">
|
||||
<label for="name">Scopes :</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
<i class="material-icons prefix">fiber_pin</i>
|
||||
<input type="text" id="roles" name="roles" value="RCA_CLOUD_EXPERT_COMPTABLE E_COLLECTE_BO_CREA E_CREATION_CREA E_QUESTIONNAIRE_CREA">
|
||||
<label for="name">Roles :</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">
|
||||
<input type="text" id="rcaPartnerId" name="rcaPartnerId" value="meg-test-interne">
|
||||
<label for="name" >ID partenaire RCA :</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user