-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat | Added configuration options for "force create user" inside Mag…
…icLinkContinuation flow (#85) * feat: make force create user configurable via ui for magic link continuation flow * refactor: added AuthenticatorSharedUtils with shared is method for Authenticators * fix: typo in getConfigProperties (usage of double setType for createUser ProviderConfigProperty) * fix: reset default param for isForceCreate inside MagicLinkContinuationAuthenticator back to false * chore: address PR review comments
- Loading branch information
1 parent
a953526
commit 54530a7
Showing
6 changed files
with
69 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/io/phasetwo/keycloak/magic/auth/util/Authenticators.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.phasetwo.keycloak.magic.auth.util; | ||
|
||
import com.google.common.base.Strings; | ||
import java.util.Map; | ||
import org.keycloak.authentication.AuthenticationFlowContext; | ||
import org.keycloak.models.AuthenticatorConfigModel; | ||
|
||
public final class Authenticators { | ||
public static boolean is( | ||
AuthenticationFlowContext context, String propName, boolean defaultValue) { | ||
AuthenticatorConfigModel authenticatorConfig = context.getAuthenticatorConfig(); | ||
if (authenticatorConfig == null) return defaultValue; | ||
|
||
Map<String, String> config = authenticatorConfig.getConfig(); | ||
if (config == null) return defaultValue; | ||
|
||
String v = config.get(propName); | ||
if (Strings.isNullOrEmpty(v)) return defaultValue; | ||
|
||
return Boolean.parseBoolean(v.trim()); | ||
} | ||
} |