// Refreshes token from UAA server
189952
func (u UAA) Refresh(refreshToken string) (Token, error) {
	return u.RefreshCommand(u, refreshToken)
}
82299
func (m *Manager) saveRefreshToken(t *refreshToken) (err error) {
	if t == nil {
		return
	}

	_, err = m.getRefreshTokenCollection().Upsert(bson.M{"refreshtoken": t.RefreshToken}, t)

	return
}
843162
func (u *Client) RefreshTokenGrant(clientId, clientSecret, refreshToken string) (string, string, error) {
	values := url.Values{
		"grant_type":    {"refresh_token"},
		"response_type": {"token"},
		"client_id":     {clientId},
		"client_secret": {clientSecret},
		"refresh_token": {refreshToken},
	}

	token, err := u.tokenGrantRequest(values)

	return token.AccessToken, token.RefreshToken, err
}
577454
func Uaa(clientId, clientSecret, username, password, accessToken, refreshToken string, usingClientCrendentials bool) Builder {
	return func(config Config) (Strategy, error) {
		httpClient := config.Client()
		authUrl, err := config.AuthURL()

		if err != nil {
			return nil, err
		}

		uaaClient := uaa.Client{
			AuthURL: authUrl,
			Client:  httpClient,
		}

		oauth := &OAuthStrategy{
			Username:                username,
			Password:                password,
			ClientId:                clientId,
			ClientSecret:            clientSecret,
			ApiClient:               httpClient,
			OAuthClient:             &uaaClient,
			ClientCredentialRefresh: usingClientCrendentials,
		}

		oauth.SetTokens(accessToken, refreshToken)

		return oauth, nil
	}
}
1192513
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
	token := &oauth2.Token{RefreshToken: refreshToken}
	ts := p.config.TokenSource(oauth2.NoContext, token)
	newToken, err := ts.Token()
	if err != nil {
		return nil, err
	}
	return newToken, err
}
159171
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
	t := &oauth2.Token{RefreshToken: refreshToken}
	ts := p.oauthConfig.TokenSource(goth.ContextForClient(p.Client()), t)

	return ts.Token()
}
293016
func (s *RemoteApplication) Refresh() error {
	applications, closer := s.st.db().GetCollection(remoteApplicationsC)
	defer closer()

	err := applications.FindId(s.doc.DocID).One(&s.doc)
	if err == mgo.ErrNotFound {
		return errors.NotFoundf("remote application %q", s)
	}
	if err != nil {
		return fmt.Errorf("cannot refresh application %q: %v", s, err)
	}
	return nil
}
574520
func (c *Credentials) Refresh() {
	c.mu.Lock()
	defer c.mu.Unlock()

	c.forceRefresh = true
}
581722
func (b *UpdateService) Refresh(refresh string) *UpdateService {
	b.refresh = refresh
	return b
}
1140082
func (s *IndexService) Refresh(refresh string) *IndexService {
	s.refresh = refresh
	return s
}
544645
func RefreshUser(host, token string) (*map[string]interface{}, error) {
	path := variables.APIPathRefreshUser
	return GenericRequest(host, path, token, nil)
}
462678
func (t *Transport) Refresh() error {
	if t.Token == nil {
		return OAuthError{"Refresh", "no existing Token"}
	}
	if t.RefreshToken == "" {
		return OAuthError{"Refresh", "Token expired; no Refresh Token"}
	}
	if t.Config == nil {
		return OAuthError{"Refresh", "no Config supplied"}
	}

	err := t.updateToken(t.Token, url.Values{
		"grant_type":    {"refresh_token"},
		"refresh_token": {t.RefreshToken},
	})
	if err != nil {
		return err
	}
	if t.TokenCache != nil {
		return t.TokenCache.PutToken(t.Token)
	}
	return nil
}
223940
func (ts *azureTokenSource) Token() (*azureToken, error) {
	ts.lock.Lock()
	defer ts.lock.Unlock()

	var err error
	token := ts.cache.getToken(azureTokenKey)
	if token == nil {
		token, err = ts.retrieveTokenFromCfg()
		if err != nil {
			token, err = ts.source.Token()
			if err != nil {
				return nil, fmt.Errorf("acquiring a new fresh token: %v", err)
			}
		}
		if !token.token.IsExpired() {
			ts.cache.setToken(azureTokenKey, token)
			err = ts.storeTokenInCfg(token)
			if err != nil {
				return nil, fmt.Errorf("storing the token in configuration: %v", err)
			}
		}
	}
	if token.token.IsExpired() {
		token, err = ts.refreshToken(token)
		if err != nil {
			return nil, fmt.Errorf("refreshing the expired token: %v", err)
		}
		ts.cache.setToken(azureTokenKey, token)
		err = ts.storeTokenInCfg(token)
		if err != nil {
			return nil, fmt.Errorf("storing the refreshed token in configuration: %v", err)
		}
	}
	return token, nil
}
947107
func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) {
	token := &oauth2.Token{RefreshToken: refreshToken}
	ctx := context.WithValue(goth.ContextForClient(p.Client()), oauth2.HTTPClient, goth.HTTPClientWithFallBack(p.Client()))
	ts := p.config.TokenSource(ctx, token)
	newToken, err := ts.Token()
	if err != nil {
		return nil, err
	}
	return newToken, err
}
1298738
func (m *Manager) getRefreshToken(token string) (rt *refreshToken, err error) {
	rt = &refreshToken{}

	err = m.getRefreshTokenCollection().Find(bson.M{"refreshtoken": token}).One(rt)
	if err == mgo.ErrNotFound {
		rt = nil
		err = nil
	}
	if err != nil {
		rt = nil
	}

	return
}
1215359
func (arc *ConfigFactory) Refresh(name string) error {
	return arc.configMgr.Refresh(name)
}
534629
func (m *CoreOSMachine) Refresh() {
	m.RLock()
	defer m.RUnlock()

	cs := m.currentState()
	if cs == nil {
		log.Warning("Unable to refresh machine state")
	} else {
		m.dynamicState = cs
	}
}