abeizn commented on code in PR #5127:
URL:
https://github.com/apache/incubator-devlake/pull/5127#discussion_r1190909114
##########
env.example:
##########
@@ -35,6 +35,8 @@ FORCE_MIGRATION=false
# Lake TAP API
TAP_PROPERTIES_DIR=
+DISABLED_REMOTE_PLUGINS=
Review Comment:
skip azuredevops by default?
##########
backend/server/services/auth/cognito.go:
##########
@@ -189,3 +203,52 @@ type Jwks struct {
E string `json:"e"`
} `json:"keys"`
}
+
+func (cgt *AwsCognitorProvider) NewPassword(newPasswordReq
*NewPasswordRequest) (*LoginResponse, errors.Error) {
+ input := &cognitoidentityprovider.RespondToAuthChallengeInput{
+ ChallengeName: aws.String("NEW_PASSWORD_REQUIRED"),
+ ChallengeResponses: map[string]*string{
+ "USERNAME": aws.String(newPasswordReq.Username),
+ "NEW_PASSWORD": aws.String(newPasswordReq.NewPassword),
+ },
+ Session: aws.String(newPasswordReq.Session),
+ ClientId: cgt.clientId,
+ }
+ response, err := cgt.client.RespondToAuthChallenge(input)
+ if err != nil {
+ return nil, errors.BadInput.Wrap(err, "Error setting up new
password: "+err.Error())
+ }
+ // yes , it is identical to the login response, and yet they are 2
different structs
+ loginRes := &LoginResponse{
+ ChallengeName: response.ChallengeName,
+ ChallengeParameters: response.ChallengeParameters,
+ Session: response.Session,
+ }
+ if response.AuthenticationResult != nil {
+ loginRes.AuthenticationResult = &AuthenticationResult{
+ AccessToken: response.AuthenticationResult.AccessToken,
+ ExpiresIn: response.AuthenticationResult.ExpiresIn,
+ IdToken: response.AuthenticationResult.IdToken,
+ RefreshToken:
response.AuthenticationResult.RefreshToken,
+ TokenType: response.AuthenticationResult.TokenType,
+ }
+ }
+ return loginRes, nil
+}
+
+// func (cgt *AwsCognitorProvider) ChangePassword(ctx *gin.Context,
oldPassword, newPassword string) errors.Error {
Review Comment:
Is this follow-up still useful?
##########
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:
auth?
--
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]