def token_rejected(response, client)
has_token = !!token
@token = nil
unless auth && auth.can_authenticate?
if has_token
raise RHC::Rest::TokenExpiredOrInvalid, "Your authorization token is expired or invalid."
end
debug "Cannot authenticate via token or password, exiting"
return false
end
if has_token
if cannot_retry?
raise RHC::Rest::TokenExpiredOrInvalid, "Your authorization token is expired or invalid."
end
if not client.supports_sessions?
raise RHC::Rest::AuthorizationsNotSupported
end
end
@can_get_token = client.supports_sessions? && @allows_tokens
if has_token
warn "Your authorization token has expired. Please sign in now to continue."
elsif @can_get_token
info "Please sign in to start a new session to #{openshift_server}."
end
return auth.retry_auth?(response, client) unless @can_get_token
debug "Creating a new authorization token"
if auth_token = client.new_session(:auth => auth)
@fetch_once = true
save(auth_token.token)
true
else
auth.retry_auth?(response, client)
end
end