Skip to content

Commit

Permalink
noise reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong committed Apr 2, 2024
1 parent dcc7c6c commit 85dd99f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions phase-2/poc-2/AuthServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AuthServer {
constructor(options) {
console.log('AuthServer created with options', options);
this.clients = options.clients;
this.scopePickerPort = options.scopePickerPort;
this.resourceHelperPort = options.resourceHelperPort;
this.grants = {};
this.tickets = {};
this.scopes = {};
Expand Down Expand Up @@ -52,7 +52,7 @@ class AuthServer {
});
}
createCallbackUrl({ clientId, code, scope, state }) {
console.log('creating callback url', clientId, code, scope, state);
// console.log('creating callback url', clientId, code, scope, state);
const codeStr = encodeURIComponent(code);
const scopeStr = encodeURIComponent(scope);
const stateStr = encodeURIComponent(state);
Expand All @@ -61,8 +61,8 @@ class AuthServer {
`scope=${scopeStr}&` +
`state=${stateStr}`;
}
createAllowUrl({ clientId, code, scope, state }) {
console.log('creating callback url', clientId, code, scope, state);
createAllowUrl({ clientId, scope, state }) {
// console.log('creating allow url', clientId, code, scope, state);
const clientIdStr = encodeURIComponent(clientId);
const scopeStr = encodeURIComponent(scope);
const stateStr = encodeURIComponent(state);
Expand Down
10 changes: 5 additions & 5 deletions phase-2/poc-2/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const clients = {
}
};
const server = new AuthServer({
scopePickerPort: 3003,
resourceHelperPort: 3003,
clients
});

Expand All @@ -36,12 +36,12 @@ function handleOverview(req, res, serverData) {
}

http.createServer(async (req, res) => {
console.log(req.url.toString());
// console.log(req.url.toString());
if (req.url.startsWith('/callback')) {
const upstreamCode = client.getCodeFromCallback(req.url);
const upstreamScope = client.getScopeFromCallback(req.url);
const upstreamState = client.getStateFromCallback(req.url);
console.log('callback', upstreamCode, upstreamScope, upstreamState);
// console.log('callback', upstreamCode, upstreamScope, upstreamState);
const { clientState, clientId } = server.getTicket(upstreamState);
const clientLabel = clients[clientId].label;
const clientRedirectUri = clients[clientId].redirectUri;
Expand Down Expand Up @@ -76,9 +76,9 @@ http.createServer(async (req, res) => {
} else if (req.url?.startsWith('/authorize')) {
const url_parts = url.parse(req.url, true);
const query = url_parts.query;
console.log('new transaction', query);
// console.log('new transaction', query);
if (query.scope == 'webdav-folder') {
console.log(`need to pick ${query.scope}!`);
// console.log(`need to pick ${query.scope}!`);
if (query.state && query.client_id) {
const clientState = query.state;
const upstreamTicket = makeid('as-ticket-', 8);
Expand Down
2 changes: 1 addition & 1 deletion phase-2/poc-2/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Client {
const scope = this.getScopeFromCallback(urlStr);
const state = this.getStateFromCallback(urlStr);
const scopeInfo = await this.fetchScopeInfo(code);
console.log('scope info', scopeInfo);
// console.log('scope info', scopeInfo);
this.tokens[code] = {
scopeInfo,
scope,
Expand Down
2 changes: 1 addition & 1 deletion phase-2/poc-2/clientApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const client = new Client({

http.createServer(async (req, res) => {
res.writeHead(200, {'Content-Type': 'text/html'});
console.log(req.url.toString());
// console.log(req.url.toString());
if (req.url.startsWith('/callback')) {
res.end(await client.makeCallbackScreen(req.url));
} else {
Expand Down
4 changes: 2 additions & 2 deletions phase-2/poc-2/rh.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function handleOverview(req, res, serverData) {
}

http.createServer((req, res) => {
console.log(req.url.toString());
// console.log(req.url.toString());
if (req.url?.startsWith('/authorize')) {
const url_parts = url.parse(req.url, true);
const query = url_parts.query;
Expand Down Expand Up @@ -97,7 +97,7 @@ http.createServer((req, res) => {
const query = url_parts.query;
const clientId = query.client_id;
const state = query.state;
console.log(`new transaction; minting scope ${scopeId} with code ${code}`, query);
// console.log(`new transaction; minting scope ${scopeId} with code ${code}`, query);
// FIXME: store this _after_ the user consents, not before!
server.storeScopeInfo(scopeId, {
type: "description",
Expand Down

0 comments on commit 85dd99f

Please sign in to comment.