private Authentication getAuthentication( RepositorySystemSession session, ArtifactRepository repository )
{
if ( session != null )
{
AuthenticationSelector selector = session.getAuthenticationSelector();
if ( selector != null )
{
RemoteRepository repo = RepositoryUtils.toRepo( repository );
org.eclipse.aether.repository.Authentication auth = selector.getAuthentication( repo );
if ( auth != null )
{
repo = new RemoteRepository.Builder( repo ).setAuthentication( auth ).build();
AuthenticationContext authCtx = AuthenticationContext.forRepository( session, repo );
Authentication result =