mirror of
https://github.com/p08dev/keycloak-hcaptcha.git
synced 2026-06-17 12:43:50 +02:00
style: 🎨 Fixed indentation
Mixed indentation from eclipse fixed by chaning all from tabs to spaces
This commit is contained in:
@ -41,68 +41,68 @@ public class RegistrationhCaptcha implements FormAction, FormActionFactory {
|
|||||||
|
|
||||||
public static final String PROVIDER_ID = "registration-hcaptcha-action";
|
public static final String PROVIDER_ID = "registration-hcaptcha-action";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FormAction create(KeycloakSession session) {
|
public FormAction create(KeycloakSession session) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Scope config) {
|
public void init(Scope config) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postInit(KeycloakSessionFactory factory) {
|
public void postInit(KeycloakSessionFactory factory) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return PROVIDER_ID;
|
return PROVIDER_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayType() {
|
public String getDisplayType() {
|
||||||
return "hCaptcha";
|
return "hCaptcha";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getReferenceCategory() {
|
public String getReferenceCategory() {
|
||||||
return HCAPTCHA_REFERENCE_CATEGORY;
|
return HCAPTCHA_REFERENCE_CATEGORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConfigurable() {
|
public boolean isConfigurable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = {
|
private static AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = {
|
||||||
AuthenticationExecutionModel.Requirement.REQUIRED,
|
AuthenticationExecutionModel.Requirement.REQUIRED,
|
||||||
AuthenticationExecutionModel.Requirement.DISABLED
|
AuthenticationExecutionModel.Requirement.DISABLED
|
||||||
};
|
};
|
||||||
@Override
|
@Override
|
||||||
public Requirement[] getRequirementChoices() {
|
public Requirement[] getRequirementChoices() {
|
||||||
return REQUIREMENT_CHOICES;
|
return REQUIREMENT_CHOICES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUserSetupAllowed() {
|
public boolean isUserSetupAllowed() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHelpText() {
|
public String getHelpText() {
|
||||||
return "Adds hCaptcha button. hCaptchas verify that the entity that is registering is a human. This can only be used on the internet and must be configured after you add it.";
|
return "Adds hCaptcha button. hCaptchas verify that the entity that is registering is a human. This can only be used on the internet and must be configured after you add it.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildPage(FormContext context, LoginFormsProvider form) {
|
public void buildPage(FormContext context, LoginFormsProvider form) {
|
||||||
AuthenticatorConfigModel captchaConfig = context.getAuthenticatorConfig();
|
AuthenticatorConfigModel captchaConfig = context.getAuthenticatorConfig();
|
||||||
String userLanguageTag = context.getSession().getContext().resolveLocale(context.getUser()).toLanguageTag();
|
String userLanguageTag = context.getSession().getContext().resolveLocale(context.getUser()).toLanguageTag();
|
||||||
|
|
||||||
@ -121,10 +121,10 @@ public class RegistrationhCaptcha implements FormAction, FormActionFactory {
|
|||||||
form.setAttribute("hcaptchaSiteKey", siteKey);
|
form.setAttribute("hcaptchaSiteKey", siteKey);
|
||||||
form.addScript("https://js.hcaptcha.com/1/api.js?hl=" + userLanguageTag);
|
form.addScript("https://js.hcaptcha.com/1/api.js?hl=" + userLanguageTag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate(ValidationContext context) {
|
public void validate(ValidationContext context) {
|
||||||
|
|
||||||
MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
|
MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
|
||||||
List<FormMessage> errors = new ArrayList<>();
|
List<FormMessage> errors = new ArrayList<>();
|
||||||
@ -150,7 +150,7 @@ public class RegistrationhCaptcha implements FormAction, FormActionFactory {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean validateRecaptcha(ValidationContext context, boolean success, String captcha, String secret) {
|
protected boolean validateRecaptcha(ValidationContext context, boolean success, String captcha, String secret) {
|
||||||
@ -167,7 +167,7 @@ public class RegistrationhCaptcha implements FormAction, FormActionFactory {
|
|||||||
InputStream content = response.getEntity().getContent();
|
InputStream content = response.getEntity().getContent();
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Map json = JsonSerialization.readValue(content, Map.class);
|
Map json = JsonSerialization.readValue(content, Map.class);
|
||||||
Object val = json.get("success");
|
Object val = json.get("success");
|
||||||
success = Boolean.TRUE.equals(val);
|
success = Boolean.TRUE.equals(val);
|
||||||
} finally {
|
} finally {
|
||||||
@ -180,25 +180,25 @@ public class RegistrationhCaptcha implements FormAction, FormActionFactory {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void success(FormContext context) {
|
public void success(FormContext context) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean requiresUser() {
|
public boolean requiresUser() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user) {
|
public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRequiredActions(KeycloakSession session, RealmModel realm, UserModel user) {
|
public void setRequiredActions(KeycloakSession session, RealmModel realm, UserModel user) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final List<ProviderConfigProperty> CONFIG_PROPERTIES = new ArrayList<ProviderConfigProperty>();
|
private static final List<ProviderConfigProperty> CONFIG_PROPERTIES = new ArrayList<ProviderConfigProperty>();
|
||||||
|
|
||||||
@ -224,9 +224,9 @@ public class RegistrationhCaptcha implements FormAction, FormActionFactory {
|
|||||||
CONFIG_PROPERTIES.add(property);
|
CONFIG_PROPERTIES.add(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProviderConfigProperty> getConfigProperties() {
|
public List<ProviderConfigProperty> getConfigProperties() {
|
||||||
return CONFIG_PROPERTIES;
|
return CONFIG_PROPERTIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user