From 8afc62a50de921ec161ed3311791357de0693804 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Fri, 21 Feb 2020 18:51:38 +0000 Subject: [PATCH] add oidc --- site/callback | 207 ++++++++++++++++++++++++++++++++++++++++++++++++++ site/infos.js | 10 +-- 2 files changed, 212 insertions(+), 5 deletions(-) create mode 100644 site/callback diff --git a/site/callback b/site/callback new file mode 100644 index 0000000..3ee3a41 --- /dev/null +++ b/site/callback @@ -0,0 +1,207 @@ + + + + OAuth2 Demo Login + + + + + + +

Yolo App login page

+

Authorization process done!

+ ← go back to main page +

Authorization Status

+

+        
+

State

+ The process should also return the state provided. +

+        
+

Code

+

The code is generated by the Authentication server and send back + to the client via the resource's owner user-agent

+

For us, it is a JWT:

+

+            

Which once decoded is:

+

+            

Tokens

+

Now the client server need to retrieve an Access Token + and a Refresh Token by using that code.

+

To achieve that the client will make a call to /token + using a basic auth creds

+

You have about 10 mins to retrieve them. + Unlike in this demo, that MUST be done server side.

+
+ Get Access & Refresh Tokens from Code +
+

Response from /token

+

token endpoint URL: Nothing yet.

+
Nothing yet.
+

decoded id_token

+
Nothing yet.
+

decoded access-token

+
Nothing yet.
+

decoded refresh-token

+
Nothing yet.
+

Using the API

+
+ Make an API call with the access token +
+

API URL: Nothing yet.

+
Nothing yet.
+

Getting new access token without user interaction

+

The access tokens are the only tokens which are able to talk to the + Visibility API.

+

Access tokens live a short time (about 10 min to 1 hour)

+

This is why the client must require a new access token using its + refresh token. + That is just making another call to /token + But with different parameters.

+
+ Get Access Tokens from Refresh Token +
+
Nothing yet.
+
Nothing yet.
+
+ + + diff --git a/site/infos.js b/site/infos.js index 323128e..dfc410b 100644 --- a/site/infos.js +++ b/site/infos.js @@ -1,11 +1,11 @@ -var oauthURLPrefix="https://visibility.amp.cisco.com"; +var oauthURLPrefix="https://visibility.int.iroh.site"; var oauthServerUrl=oauthURLPrefix + "/iroh/oauth2/authorize"; var oauthServerTokenUrl=oauthURLPrefix + "/iroh/oauth2/token"; var resourceProviderTestEndpoint=oauthURLPrefix + "/iroh/profile/whoami" ; var response_type="code"; -var client_id="client-3bb1e787-381d-4f12-bf32-e1158f200ddc"; -var client_password = "CrXwg31_vnRHpjPXzgVzUFKHr6RO8GTL-iI8aDeUU3n48NtD7PFLhg"; -var redirect_uri="https://localhost:5443/callback.html"; -var scopes=[ "profile", "inspect" ]; +var client_id="client-92258bc0-196a-4f6c-a0b5-fe105de5f505"; +var client_password = "xoM2Gisjqp7Sp1jnw9Y6Yce9gfg4hmoRxZTekLqKi6i7o1xBiPvLvA"; +var redirect_uri="https://localhost:5443/callback"; +var scopes=[ "openid" ]; var scope=scopes.join(" "); var state="whatever=";