hezyin commented on code in PR #5127:
URL:
https://github.com/apache/incubator-devlake/pull/5127#discussion_r1191737163
##########
backend/server/api/login/login.go:
##########
@@ -18,56 +18,64 @@ limitations under the License.
package login
import (
+ "net/http"
+
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/server/api/shared"
"github.com/apache/incubator-devlake/server/services/auth"
- "net/http"
"github.com/gin-gonic/gin"
)
-type LoginRequest struct {
- Username string `json:"username"`
- Password string `json:"password"`
-}
-
-type LoginResponse struct {
- AuthenticationResult AuthenticationResult `json:"AuthenticationResult"`
- ChallengeName interface{} `json:"ChallengeName"`
- ChallengeParameters ChallengeParameters `json:"ChallengeParameters"`
- Session interface{} `json:"Session"`
-}
-type AuthenticationResult struct {
- AccessToken string `json:"AccessToken"`
- ExpiresIn int `json:"ExpiresIn"`
- IDToken string `json:"IdToken"`
- NewDeviceMetadata interface{} `json:"NewDeviceMetadata"`
- RefreshToken string `json:"RefreshToken"`
- TokenType string `json:"TokenType"`
-}
-type ChallengeParameters struct {
-}
-
// @Summary post login
// @Description post login
// @Tags framework/login
// @Accept application/json
-// @Param blueprint body LoginRequest true "json"
+// @Param blueprint body aut.LoginRequest true "json"
Review Comment:
@klesh Could you please clarify what blueprint mean in this annotation?
Also the `aut` needs to be corrected.
##########
backend/server/services/auth/auth.go:
##########
@@ -0,0 +1,91 @@
+/*
+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.
+*/
+
+package auth
+
+import (
+ "net/http"
+
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/gin-gonic/gin"
+)
+
+// data structures
+
+type LoginRequest struct {
+ Username string `json:"username"`
+ Password string `json:"password"`
+}
+
+type LoginResponse struct {
+ AuthenticationResult *AuthenticationResult `json:"authenticationResult"`
+ ChallengeName *string `json:"challengeName"`
+ ChallengeParameters map[string]*string `json:"challengeParameters"`
+ Session *string `json:"session"`
+}
+
+type AuthenticationResult struct {
+ AccessToken *string `json:"accessToken" type:"string" sensitive:"true"`
+ ExpiresIn *int64 `json:"expiresIn" type:"integer"`
+ IdToken *string `json:"idToken" type:"string" sensitive:"true"`
+ RefreshToken *string `json:"refreshToken" type:"string"
sensitive:"true"`
+ TokenType *string `json:"tokenType" type:"string"`
+}
+
+type ChallengeParameters struct {
Review Comment:
@klesh Seems like we're no longer using this, shall we remove it?
##########
backend/server/services/auth/cognito.go:
##########
@@ -26,129 +26,133 @@ import (
"math/big"
"net/http"
"strings"
- "sync"
"github.com/apache/incubator-devlake/core/config"
- "github.com/apache/incubator-devlake/impls/logruslog"
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cognitoidentityprovider"
"github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
)
-var (
- //jwksCache is a cache of the fetched JWKS
- jwksCache Jwks
- //jwksCacheMx is a mutex to lock the jwksCache
- jwksCacheMx sync.Mutex
- logger = logruslog.Global.Nested("auth")
-)
+type AwsCognitorProvider struct {
Review Comment:
@klesh Curious why did you name this `AwsCognitorProvider` instead of
`AwsCognitoProvider`?
--
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]