PrepareApiClient splits Token to tokens for SetupAuthentication to utilize
(apiClient plugin.ApiClient)
| 75 | |
| 76 | // PrepareApiClient splits Token to tokens for SetupAuthentication to utilize |
| 77 | func (conn *GithubConn) PrepareApiClient(apiClient plugin.ApiClient) errors.Error { |
| 78 | |
| 79 | if conn.AuthMethod == AccessToken { |
| 80 | conn.tokens = strings.Split(conn.Token, ",") |
| 81 | } |
| 82 | |
| 83 | if conn.AuthMethod == AppKey && conn.InstallationID != 0 { |
| 84 | token, err := conn.GetInstallationAccessToken(apiClient) |
| 85 | if err != nil { |
| 86 | return err |
| 87 | } |
| 88 | var expiresAt *time.Time |
| 89 | if !token.ExpiresAt.IsZero() { |
| 90 | expiresAt = &token.ExpiresAt |
| 91 | } |
| 92 | conn.UpdateToken(token.Token, "", expiresAt, nil) |
| 93 | } |
| 94 | |
| 95 | return nil |
| 96 | } |
| 97 | |
| 98 | // SetupAuthentication sets up the HTTP Request Authentication |
| 99 | func (conn *GithubConn) SetupAuthentication(req *http.Request) errors.Error { |
nothing calls this directly
no test coverage detected