wochae / transBack

0 stars 0 forks source link

다크로드 #12

Open wochae opened 1 year ago

wochae commented 1 year ago

[ ✒️ 제목 ]

    const userData: {token: CertificateObject; user: any;} = {
      token: null,
      user: null,
    }
    let intraInfo: IntraInfoDto;
    this.logger.log('codeCallback start');
    this.logger.log(`codeCallback query : ${query.code}`);
    this.logger.log(`codeCallback res.headersSent : ${res.headersSent}`);
    async (res:Response): Promise<void> => {
      const log = res.getHeaderNames().toString();
      this.logger.log(`codeCallback res.getHeaderNames : ${log}`)
    };

    this.logger.log(`codeCallback req.headers : ${req.headers}`);
    this.logger.log(`codeCallback req.headers.authorization : ${req.headers.authorization}`); // find it out !
    this.logger.log(`codeCallback req.headers.Authorization_true, false : ${req.headers.Authorization !== undefined? true: false}`);
    this.logger.log(`codeCallback req.headers.cookie : ${req.headers.cookie}`);
    this.logger.log(`codeCallback req.body : ${req.body}`);
    this.logger.log(`codeCallback req.cookies : ${req.cookies}`)
    this.logger.log(`codeCallback req.cookies : ${req.body}`);
    authHeader = req.headers.authorization.startsWith('Bearer') ? req.headers.authorization.split(' ')[1] : req.headers.authorization;
    if (authHeader === undefined || authHeader === null) {
      this.logger.log('codeCallback authHeader null');
      intraInfo = await this.loginService.getIntraInfo(query.code);
    } else {
    const userDto = await this.usersService.validateUser(authHeader);
    intraInfo = plainToClass(IntraInfoDto, userDto);
    }
    const userInfo = await this.loginService.getUserInfo(intraInfo);

    // const token = await this.loginService.issueToken(userInfo.id, userInfo.check2Auth);
    userData.user = await this.usersService.findOneUser(userInfo.id);
    const createdCertificateDto: CreateCertificateDto = {token:userInfo.accessToken, check2Auth: false, email: intraInfo.email, userIdx: userInfo.id};
    userData.token = await this.usersService.saveToken(createdCertificateDto);
    this.logger.log(`check userData isExist : ${userData.token.token}`); 
    // res.headers.authorization = `Authentication=${userData.token.token}; Path=/; HttpOnly; Max-Age=86400`;
    this.logger.log(`check res.headers.cookie : ${res.headers.cookie}`);
    this.logger.log('codeCallback end accessToken', userInfo.accessToken);

    this.logger.log('res.header', res.header);
    this.logger.log('res.headers', res.headers);
    this.logger.log('res.headers.cookie', res.headers.cookie);
    this.logger.log('res.headers.authorization', res.headers.authorization);
    this.logger.log('res.body', res.body);
[Nest] 88174  - 2023. 08. 07. 오후 9:09:40     LOG [NestApplication] Nest application successfully started +10ms
listening on port, 4000
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback start
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback query : eac6bd02c92b52a4d4be04009ca6de57aca541fc6d4c04949597046958626302
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback res.headersSent : false
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.headers : [object Object]
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.headers.authorization : Bearer aa5b5a776e2f1ef6f60a8f1cf98b7b695535d947adc84026c0d72e780b293e25
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.headers.Authorization_true, false : false
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.headers.cookie : undefined
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.body : [object Object]
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.cookies : undefined
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [LoginController] codeCallback req.cookies : [object Object]
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [UsersService] validateUser function
[Nest] 88174  - 2023. 08. 07. 오후 9:09:59     LOG [UsersService] aa5b5a776e2f1ef6f60a8f1cf98b7b695535d947adc84026c0d72e780b293e25
[Nest] 88174  - 2023. 08. 07. 오후 9:10:00     LOG [LoginService] getUserInfo start

[ 📄 상세 내용 ]

wochae commented 1 year ago

https://dhsimpson-ml-and-sw.tistory.com/15