File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed
src/main/java/com/authsignal/keycloak Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ plugins {
1010}
1111
1212group ' com.authsignal'
13- version ' 2.1.3 '
13+ version ' 2.1.4-beta.1 '
1414
1515repositories {
1616 mavenCentral()
Original file line number Diff line number Diff line change @@ -71,18 +71,13 @@ private boolean handlePasswordAuthentication(AuthenticationFlowContext context)
7171 String username = formParams .getFirst ("username" );
7272 String password = formParams .getFirst ("password" );
7373
74- if (username == null || username .isEmpty () || password == null || password .isEmpty ()) {
75- logger .warning ("Username or password is missing" );
76- context .failureChallenge (AuthenticationFlowError .INVALID_CREDENTIALS , context .form ()
77- .setError ("Invalid username or password" )
78- .createForm ("login.ftl" ));
79- return false ;
80- }
81-
82- UserModel user = context .getSession ().users ().getUserByUsername (context .getRealm (), username );
83-
84- if (user == null ) {
85- user = context .getSession ().users ().getUserByEmail (context .getRealm (), username );
74+ // Use user from context if already set (e.g., after brokered login)
75+ UserModel user = context .getUser ();
76+ if (user == null && username != null && !username .isEmpty ()) {
77+ user = context .getSession ().users ().getUserByUsername (context .getRealm (), username );
78+ if (user == null ) {
79+ user = context .getSession ().users ().getUserByEmail (context .getRealm (), username );
80+ }
8681 }
8782
8883 if (user == null ) {
@@ -302,4 +297,4 @@ private Boolean enrolByDefault(AuthenticationFlowContext context) {
302297 .valueOf (config .getConfig ().get (AuthsignalAuthenticatorFactory .PROP_ENROL_BY_DEFAULT ));
303298 return enrolByDefault ;
304299 }
305- }
300+ }
You can’t perform that action at this time.
0 commit comments