Fix feedback @moufmouf
This commit is contained in:
parent
a4b8a8422f
commit
210a789aa4
@ -22,7 +22,7 @@ MAX_USERNAME_LENGTH=8
|
|||||||
OPID_CLIENT_ID=
|
OPID_CLIENT_ID=
|
||||||
OPID_CLIENT_SECRET=
|
OPID_CLIENT_SECRET=
|
||||||
OPID_CLIENT_ISSUER=
|
OPID_CLIENT_ISSUER=
|
||||||
OPID_CLIENT_REDIREC_URL=
|
OPID_CLIENT_REDIRECT_URL=
|
||||||
OPID_LOGIN_SCREEN_PROVIDER=http://pusher.workadventure.localhost/login-screen
|
OPID_LOGIN_SCREEN_PROVIDER=http://pusher.workadventure.localhost/login-screen
|
||||||
OPID_PROFILE_SCREEN_PROVIDER=
|
OPID_PROFILE_SCREEN_PROVIDER=
|
||||||
DISABLE_ANONYMOUS=
|
DISABLE_ANONYMOUS=
|
||||||
|
@ -71,7 +71,7 @@ services:
|
|||||||
OPID_CLIENT_ID: $OPID_CLIENT_ID
|
OPID_CLIENT_ID: $OPID_CLIENT_ID
|
||||||
OPID_CLIENT_SECRET: $OPID_CLIENT_SECRET
|
OPID_CLIENT_SECRET: $OPID_CLIENT_SECRET
|
||||||
OPID_CLIENT_ISSUER: $OPID_CLIENT_ISSUER
|
OPID_CLIENT_ISSUER: $OPID_CLIENT_ISSUER
|
||||||
OPID_CLIENT_REDIREC_URL: $OPID_CLIENT_REDIREC_URL
|
OPID_CLIENT_REDIRECT_URL: $OPID_CLIENT_REDIRECT_URL
|
||||||
OPID_PROFILE_SCREEN_PROVIDER: $OPID_PROFILE_SCREEN_PROVIDER
|
OPID_PROFILE_SCREEN_PROVIDER: $OPID_PROFILE_SCREEN_PROVIDER
|
||||||
DISABLE_ANONYMOUS: $DISABLE_ANONYMOUS
|
DISABLE_ANONYMOUS: $DISABLE_ANONYMOUS
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -73,7 +73,7 @@ services:
|
|||||||
OPID_CLIENT_ID: $OPID_CLIENT_ID
|
OPID_CLIENT_ID: $OPID_CLIENT_ID
|
||||||
OPID_CLIENT_SECRET: $OPID_CLIENT_SECRET
|
OPID_CLIENT_SECRET: $OPID_CLIENT_SECRET
|
||||||
OPID_CLIENT_ISSUER: $OPID_CLIENT_ISSUER
|
OPID_CLIENT_ISSUER: $OPID_CLIENT_ISSUER
|
||||||
OPID_CLIENT_REDIREC_URL: $OPID_CLIENT_REDIREC_URL
|
OPID_CLIENT_REDIRECT_URL: $OPID_CLIENT_REDIRECT_URL
|
||||||
OPID_PROFILE_SCREEN_PROVIDER: $OPID_PROFILE_SCREEN_PROVIDER
|
OPID_PROFILE_SCREEN_PROVIDER: $OPID_PROFILE_SCREEN_PROVIDER
|
||||||
DISABLE_ANONYMOUS: $DISABLE_ANONYMOUS
|
DISABLE_ANONYMOUS: $DISABLE_ANONYMOUS
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -183,8 +183,11 @@ class ConnectionManager {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
await this.checkAuthUserConnexion();
|
await this.checkAuthUserConnexion();
|
||||||
|
analyticsClient.loggedWithSso();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
this.loadOpenIDScreen();
|
||||||
|
return Promise.reject(new Error("You will be redirect on login page"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null
|
this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null
|
||||||
|
@ -66,7 +66,6 @@ export class AuthenticateController extends BaseController {
|
|||||||
throw Error("Token cannot to be check on Hydra");
|
throw Error("Token cannot to be check on Hydra");
|
||||||
}
|
}
|
||||||
const resCheckTokenAuth = await openIDClient.checkTokenAuth(authTokenData.accessToken);
|
const resCheckTokenAuth = await openIDClient.checkTokenAuth(authTokenData.accessToken);
|
||||||
console.log("resCheckTokenAuth", resCheckTokenAuth);
|
|
||||||
res.writeStatus("200");
|
res.writeStatus("200");
|
||||||
this.addCorsHeaders(res);
|
this.addCorsHeaders(res);
|
||||||
return res.end(JSON.stringify({ authToken: token }));
|
return res.end(JSON.stringify({ authToken: token }));
|
||||||
|
@ -44,10 +44,10 @@ export class OpenIdProfileController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildHtml(domain: string, email: string, pictureUrl?: string) {
|
buildHtml(domain: string, email: string, pictureUrl?: string) {
|
||||||
return (
|
return `
|
||||||
"<!DOCTYPE html>" +
|
<!DOCTYPE>
|
||||||
`
|
<html>
|
||||||
<header>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
*{
|
*{
|
||||||
font-family: PixelFont-7, monospace;
|
font-family: PixelFont-7, monospace;
|
||||||
@ -60,7 +60,7 @@ export class OpenIdProfileController extends BaseController {
|
|||||||
margin: 20px;
|
margin: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</header>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<section>
|
<section>
|
||||||
@ -74,7 +74,7 @@ export class OpenIdProfileController extends BaseController {
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`
|
</html>
|
||||||
);
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ export const FRONT_URL = process.env.FRONT_URL || "http://localhost";
|
|||||||
export const OPID_CLIENT_ID = process.env.OPID_CLIENT_ID || "";
|
export const OPID_CLIENT_ID = process.env.OPID_CLIENT_ID || "";
|
||||||
export const OPID_CLIENT_SECRET = process.env.OPID_CLIENT_SECRET || "";
|
export const OPID_CLIENT_SECRET = process.env.OPID_CLIENT_SECRET || "";
|
||||||
export const OPID_CLIENT_ISSUER = process.env.OPID_CLIENT_ISSUER || "";
|
export const OPID_CLIENT_ISSUER = process.env.OPID_CLIENT_ISSUER || "";
|
||||||
export const OPID_CLIENT_REDIREC_URL = process.env.OPID_CLIENT_REDIREC_URL || FRONT_URL + "/jwt";
|
export const OPID_CLIENT_REDIRECT_URL = process.env.OPID_CLIENT_REDIRECT_URL || FRONT_URL + "/jwt";
|
||||||
export const OPID_PROFILE_SCREEN_PROVIDER = process.env.OPID_PROFILE_SCREEN_PROVIDER || ADMIN_URL + "/profile";
|
export const OPID_PROFILE_SCREEN_PROVIDER = process.env.OPID_PROFILE_SCREEN_PROVIDER || ADMIN_URL + "/profile";
|
||||||
export const DISABLE_ANONYMOUS = process.env.DISABLE_ANONYMOUS || false;
|
export const DISABLE_ANONYMOUS = process.env.DISABLE_ANONYMOUS || false;
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
OPID_CLIENT_ID,
|
OPID_CLIENT_ID,
|
||||||
OPID_CLIENT_SECRET,
|
OPID_CLIENT_SECRET,
|
||||||
OPID_CLIENT_ISSUER,
|
OPID_CLIENT_ISSUER,
|
||||||
OPID_CLIENT_REDIREC_URL,
|
OPID_CLIENT_REDIRECT_URL,
|
||||||
} from "../Enum/EnvironmentVariable";
|
} from "../Enum/EnvironmentVariable";
|
||||||
|
|
||||||
class OpenIDClient {
|
class OpenIDClient {
|
||||||
@ -15,7 +15,7 @@ class OpenIDClient {
|
|||||||
return new issuer.Client({
|
return new issuer.Client({
|
||||||
client_id: OPID_CLIENT_ID,
|
client_id: OPID_CLIENT_ID,
|
||||||
client_secret: OPID_CLIENT_SECRET,
|
client_secret: OPID_CLIENT_SECRET,
|
||||||
redirect_uris: [OPID_CLIENT_REDIREC_URL],
|
redirect_uris: [OPID_CLIENT_REDIRECT_URL],
|
||||||
response_types: ["code"],
|
response_types: ["code"],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -38,7 +38,7 @@ class OpenIDClient {
|
|||||||
|
|
||||||
public getUserInfo(code: string, nonce: string): Promise<{ email: string; sub: string; access_token: string }> {
|
public getUserInfo(code: string, nonce: string): Promise<{ email: string; sub: string; access_token: string }> {
|
||||||
return this.initClient().then((client) => {
|
return this.initClient().then((client) => {
|
||||||
return client.callback(OPID_CLIENT_REDIREC_URL, { code }, { nonce }).then((tokenSet) => {
|
return client.callback(OPID_CLIENT_REDIRECT_URL, { code }, { nonce }).then((tokenSet) => {
|
||||||
return client.userinfo(tokenSet).then((res) => {
|
return client.userinfo(tokenSet).then((res) => {
|
||||||
return {
|
return {
|
||||||
...res,
|
...res,
|
||||||
|
Loading…
Reference in New Issue
Block a user