private boolean confirmAndResetUsersCredentials ( AuthenticationMethodType type ) { ExtensionUserManagement usersExtension = Control . getSingleton ( ) . getExtensionLoader ( ) . getExtension ( ExtensionUserManagement . class ) ; if ( usersExtension == null ) { return true ; } List < User > users = usersExtension . getSharedContextUsers ( getUISharedContext ( ) ) ; if ( users . isEmpty ( ) ) { return true ; } if ( users . stream ( ) . anyMatch ( user -> user . getAuthenticationCredentials ( ) . isConfigured ( ) ) ) { authenticationMethodsComboBox . transferFocus ( ) ; int choice = JOptionPane . showConfirmDialog ( this , Constant . messages . getString ( "authentication.dialog.confirmChange.label" ) , Constant . messages . getString ( "authentication.dialog.confirmChange.title" ) , JOptionPane . OK_CANCEL_OPTION ) ; if ( choice == JOptionPane . CANCEL_OPTION ) { return false ; } } users . replaceAll ( user -> { User modifiedUser = new User ( user . getContextId ( ) , user . getName ( ) , user . getId ( ) ) ; modifiedUser . setEnabled ( false ) ; modifiedUser . setAuthenticationCredentials ( type . createAuthenticationCredentials ( ) ) ; return modifiedUser ; } ) ; return true ; }
Make sure the user acknowledges the Users corresponding to this context will have the credentials changed with the new type of authentication method .