I have to create a custom login in wildfly who have to go to check if the user is authorized by my java code, to do so i create a class who extend: extends UsernamePasswordLoginModule so i called this by the method: request.login(user1, pass1); so in wildfly i added a security domain who were able to call my class. The problem is this now, i have two login button one should authorize the user with my java code (the one i created) the old one should keep follow the old flow and get The applicationRealm by wildfly (get the user form the apllication-users.properties) to do so the jboss-web.xml must be commented but if is commentend i cannot call my class to do the login, any idea how to move form here? i tried with the follow but after the login the user is not registered so i cannot login LoginContextlc = new LoginContext("AzureSecurityDomain", new TokenCallbackHandler(user.getName(),username)); lc.login(); lc.getSubject().getPrincipals().add(user); Continue reading...