Neilk1021 commented on code in PR #7664: URL: https://github.com/apache/texera/pull/7664#discussion_r3919074974
########## frontend/src/app/hub/component/login/orcid-callback.component.ts: ########## @@ -0,0 +1,150 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { HttpErrorResponse } from "@angular/common/http"; +import { UntilDestroy, untilDestroyed } from "@ngneat/until-destroy"; +import { Component, OnInit } from "@angular/core"; +import { ActivatedRoute, Router } from "@angular/router"; +import { catchError, skip, take } from "rxjs/operators"; +import { EMPTY } from "rxjs"; +import { NzSpinComponent } from "ng-zorro-antd/spin"; +import { UserService } from "../../../common/service/user/user.service"; +import { NotificationService } from "../../../common/service/notification/notification.service"; +import { ORCID_STATE_KEY } from "../../../common/service/user/orcid-auth.service"; +import { LOGIN, USER_WORKFLOW } from "../../../app-routing.constant"; + +/** + * Where ORCID sends the browser back to after its consent screen, carrying the one-time `code` + * that only the backend can redeem (see `OrcidAuthResource`). Nothing here is interactive: it + * checks the round trip was one we started, hands the code over, and leaves. + */ +@UntilDestroy() +@Component({ + selector: "texera-orcid-callback", + template: ` + <div class="orcid-callback"> + <nz-spin nzSimple></nz-spin> + <p>Signing you in with ORCID…</p> + </div> + `, + styles: [ + ` + .orcid-callback { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 16px; + height: 100vh; + } + `, + ], + imports: [NzSpinComponent], +}) +export class OrcidCallbackComponent implements OnInit { + constructor( + private route: ActivatedRoute, + private router: Router, + private userService: UserService, + private notificationService: NotificationService + ) {} + + ngOnInit(): void { + const params = this.route.snapshot.queryParamMap; + + const expectedState = sessionStorage.getItem(ORCID_STATE_KEY); + + //remove key to prevent leakage that would authorize future sessions Review Comment: Taken verbatim in 2430b06a — the suggested sentence replaces it, so the comment is now a formed sentence and describes `state` as a correlator rather than something that authorizes. ########## LICENSE: ########## @@ -238,6 +238,15 @@ This product includes an icon from Google's Material Symbols: Source: https://github.com/google/material-design-icons License: Apache License 2.0 (this LICENSE file) +This product includes the ORCID iD icon from ORCID, Inc.: + - frontend/src/assets/logos/ORCID-iD_icon_24x24.png Review Comment: Fixed in 0deccd21 via `git update-index --chmod=-x`; the icon is now 100644 like its nine siblings in that directory. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
