(credentials map[string]string, origin string, grantType constant.GrantType)
| 25 | } |
| 26 | |
| 27 | func (actor defaultAuthActor) Authenticate(credentials map[string]string, origin string, grantType constant.GrantType) error { |
| 28 | if (grantType == constant.GrantTypePassword || grantType == constant.GrantTypeJwtBearer) && actor.config.UAAGrantType() == string(constant.GrantTypeClientCredentials) { |
| 29 | return actionerror.PasswordGrantTypeLogoutRequiredError{} |
| 30 | } |
| 31 | |
| 32 | actor.config.UnsetOrganizationAndSpaceInformation() |
| 33 | accessToken, refreshToken, err := actor.uaaClient.Authenticate(credentials, origin, grantType) |
| 34 | if err != nil { |
| 35 | actor.config.SetTokenInformation("", "", "") |
| 36 | return err |
| 37 | } |
| 38 | |
| 39 | accessToken = fmt.Sprintf("bearer %s", accessToken) |
| 40 | actor.config.SetTokenInformation(accessToken, refreshToken, "") |
| 41 | |
| 42 | if grantType == constant.GrantTypePassword { |
| 43 | actor.config.SetUAAGrantType("") |
| 44 | } else { |
| 45 | actor.config.SetUAAGrantType(string(grantType)) |
| 46 | } |
| 47 | |
| 48 | if (grantType == constant.GrantTypeClientCredentials || grantType == constant.GrantTypeJwtBearer) && credentials["client_id"] != "" { |
| 49 | actor.config.SetUAAClientCredentials(credentials["client_id"], "") |
| 50 | } |
| 51 | |
| 52 | return nil |
| 53 | } |
| 54 | |
| 55 | func (actor defaultAuthActor) GetLoginPrompts() (map[string]coreconfig.AuthPrompt, error) { |
| 56 | rawPrompts, err := actor.uaaClient.GetLoginPrompts() |
nothing calls this directly
no test coverage detected