protected RegistryAuth registryAuth ( ) throws MojoExecutionException { if ( settings != null && serverId != null ) { final Server server = settings . getServer ( serverId ) ; if ( server != null ) { final RegistryAuth . Builder registryAuthBuilder = RegistryAuth . builder ( ) ; final String username = server . getUsername ( ) ; String password = server . getPassword ( ) ; if ( secDispatcher != null ) { try { password = secDispatcher . decrypt ( password ) ; } catch ( SecDispatcherException ex ) { throw new MojoExecutionException ( "Cannot decrypt password from settings" , ex ) ; } } final String email = getEmail ( server ) ; if ( ! isNullOrEmpty ( username ) ) { registryAuthBuilder . username ( username ) ; } if ( ! isNullOrEmpty ( email ) ) { registryAuthBuilder . email ( email ) ; } if ( ! isNullOrEmpty ( password ) ) { registryAuthBuilder . password ( password ) ; } if ( ! isNullOrEmpty ( registryUrl ) ) { registryAuthBuilder . serverAddress ( registryUrl ) ; } return registryAuthBuilder . build ( ) ; } else { // settings.xml has no entry for the configured serverId, warn the user getLog ( ) . warn ( "No entry found in settings.xml for serverId=" + serverId + ", cannot configure authentication for that registry" ) ; } } return null ; }
Builds the registryAuth object from server details .