008 payg renamed to index
This commit is contained in:
+1
-49
@@ -79,7 +79,7 @@
|
||||
|
||||
<!--- global settings --->
|
||||
<cfset request.RECORDS_PER_PAGE=500/>
|
||||
<cfset request.APP_VERSION="0.00.007"/>
|
||||
<cfset request.APP_VERSION="0.00.008"/>
|
||||
<cfset request.STAND=getStand()/>
|
||||
|
||||
<!--- application constants --->
|
||||
@@ -419,53 +419,5 @@ function getIdpCertificate(certUrl) {
|
||||
}
|
||||
}
|
||||
|
||||
function auth() {
|
||||
client_id = "payg-report.deck.nubes.ru"
|
||||
client_secret = "********"
|
||||
auth_endpoint = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/auth"
|
||||
access_token_endpoint = "https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/token"
|
||||
redirect_uri = "https://localhost/payg-report/"
|
||||
|
||||
jwt = new lib.jwt(client_secret);
|
||||
idp = new lib.oauth2(client_id, client_secret, auth_endpoint, access_token_endpoint, redirect_uri);
|
||||
|
||||
// Get URL that the user will click on and grant our application all necessary permissions
|
||||
strURL = idp.buildRedirectToAuthURL({"scope":'openid profile email',"state":createGUID().toString(),"allow_signup":true});
|
||||
echo('<a href="#strURL#">self-made Auth link (idp) #strURL#</a> <br> <br>');
|
||||
|
||||
//redreshURL = github.refreshAccessTokenRequest();
|
||||
|
||||
if(structKeyExists(url, "code")) {
|
||||
writedump(url.code);
|
||||
// Request access token from idp with the authorization code that we got via the URL
|
||||
data = deserializeJson(idp.makeAccessTokenRequest(url.code/*, aFormFields*/).content);
|
||||
// Print full response from idp
|
||||
dump(var = data, label = "makeAccessTokenRequest - Response from idp");
|
||||
|
||||
try {
|
||||
//parsed=getParamsFromUrlString(data);
|
||||
writedump(data);
|
||||
echo('<a href="./index.cfm?refresh=#data.refresh_token#">Refresh token #data.refresh_token#</a>');
|
||||
//https://keycloak.nubes.ru/realms/cloud/.well-known/openid-configuration тут ссылка
|
||||
//https://keycloak.nubes.ru/realms/cloud/protocol/openid-connect/certs тут серт
|
||||
//только надо его обрамить -----BEGIN CERTIFICATE-----
|
||||
|
||||
writedump(jwt.decode(data.access_token,"-----BEGIN CERTIFICATE-----
|
||||
MIICmTCCAYECBgGG7361eDANBgkqhkiG9w0BAQsFADAQMQ4wDAYDVQQDDAVjbG91ZDAeFw0yMzAzMTcxMjEzMjRaFw0zMzAzMTcxMjE1MDRaMBAxDjAMBgNVBAMMBWNsb3VkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAn2segSPrciUFaD7Fa+brR9JdZknQr0F8zCzYQdTPsZJMtYnVPuE7MdZlbtGQ9n/HjcUst8FINjMONhzzbwVQSRZHH57pbAEm4r7fM3QDEAKXGERtDXhVLJGQSkg17X9zSWZs4RwkbxNsG6r+3/GT+U75lTG+/LKKzdG5OHK7Wwnrsiqy7sg3wAPFtlSwbebMdXJ70FosEI1SVhPRDn+LuVH3WINvijQU1GV2srWPwZl16fdXDele6NkvnC032l00pTbkVbgBLgySR0sPsI1s5AuMTT//nA0Xm5Ss40SwLJX2BYWyEALvEYdVt9wUZU2QXcZLLgmsCcFye4HjXa2CAwIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBlvkOLPRG6+tB30ZElwKSh/xrptnxgTf93RnS4IUDZebSolR5V/77PFAuqw4DTIlBNtJ6i1ffmyvtZIAMlm3sMZK0GuQ+SFq72DHxYzSmZ61cSS5YFKKyHcX3JIFMXYLmrw11GXt69V3xB8/Y0+BnBBpDD7ZKDdXdQa+9IWsERdTAIFk7ucwiG3BuTOJbzU1d+m8hNIVL4+dYR1TAnA9QPaJaQj0kUD0DYgXcIrrTFIQF0IPeB9I+eOyJ0FxJkukffX7QLVGFrc3+dVRHSSWmMpXi0B/VXT5DlsFDstEldH+/r3XnXAY6qadciyksSBRSXR4Rm9ZEq/xk+VmcxomWc
|
||||
-----END CERTIFICATE-----","RS256"));
|
||||
} catch (e) {echo('<br>****************** #e.message# : #e.detail# **********');}
|
||||
|
||||
}
|
||||
|
||||
if(structKeyExists(url, "refresh")) {
|
||||
|
||||
// With the refresh_token we can easly request a new access token
|
||||
refreshedToken = deserializeJson(idp.refreshAccessTokenRequest(url.refresh).content);
|
||||
dump(var = refreshedToken, label = "refreshAccessTokenRequest - Response from IDP");
|
||||
|
||||
echo('<br> <a href="./index.cfm?refresh=#refreshedToken.refresh_token#">Refresh token #refreshedToken.refresh_token#</a>')
|
||||
writedump(jwt.decode(refreshedToken.access_token));
|
||||
}
|
||||
}
|
||||
</cfscript>
|
||||
</cfcomponent>
|
||||
Reference in New Issue
Block a user