-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from bcgov/feat/authflows
chore: format java codes
- Loading branch information
Showing
22 changed files
with
1,355 additions
and
948 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ terraform 1.0.7 | |
terraform-docs 0.12.1 | ||
tflint 0.28.1 | ||
java openjdk-14.0.1 | ||
gradle 7.3.1 |
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,5 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# These are explicitly windows files and should use crlf | ||
*.bat text eol=crlf |
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,5 @@ | ||
# Ignore Gradle project-specific cache directory | ||
.gradle | ||
|
||
# Ignore Gradle build output directory | ||
build |
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,8 @@ | ||
// see https://github.com/sherter/google-java-format-gradle-plugin | ||
plugins { | ||
id 'com.github.sherter.google-java-format' version '0.9' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
316 changes: 176 additions & 140 deletions
316
.../services/src/main/java/com/github/bcgov/keycloak/IdpCreateUserIfUniqueAuthenticator.java
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
|
||
package com.github.bcgov.keycloak; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.keycloak.Config; | ||
import org.keycloak.authentication.Authenticator; | ||
import org.keycloak.authentication.AuthenticatorFactory; | ||
|
@@ -25,88 +27,77 @@ | |
import org.keycloak.models.KeycloakSessionFactory; | ||
import org.keycloak.provider.ProviderConfigProperty; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">Marek Posolda</a> | ||
*/ | ||
/** @author <a href="mailto:[email protected]">Marek Posolda</a> */ | ||
public class IdpCreateUserIfUniqueAuthenticatorFactory implements AuthenticatorFactory { | ||
|
||
public static final String PROVIDER_ID = "bcgov-idp-create-user-if-unique"; | ||
static IdpCreateUserIfUniqueAuthenticator SINGLETON = new IdpCreateUserIfUniqueAuthenticator(); | ||
|
||
|
||
@Override | ||
public Authenticator create(KeycloakSession session) { | ||
return SINGLETON; | ||
} | ||
|
||
@Override | ||
public void init(Config.Scope config) { | ||
|
||
} | ||
|
||
@Override | ||
public void postInit(KeycloakSessionFactory factory) { | ||
|
||
} | ||
|
||
@Override | ||
public void close() { | ||
|
||
} | ||
|
||
@Override | ||
public String getId() { | ||
return PROVIDER_ID; | ||
} | ||
|
||
@Override | ||
public String getReferenceCategory() { | ||
return "createUserIfUnique"; | ||
} | ||
|
||
@Override | ||
public boolean isConfigurable() { | ||
return false; | ||
} | ||
|
||
public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = { | ||
AuthenticationExecutionModel.Requirement.ALTERNATIVE, | ||
AuthenticationExecutionModel.Requirement.REQUIRED, | ||
AuthenticationExecutionModel.Requirement.DISABLED}; | ||
|
||
@Override | ||
public AuthenticationExecutionModel.Requirement[] getRequirementChoices() { | ||
return REQUIREMENT_CHOICES; | ||
} | ||
|
||
@Override | ||
public String getDisplayType() { | ||
return "Create User If Unique (BCGOV)"; | ||
} | ||
|
||
@Override | ||
public String getHelpText() { | ||
return "Detect if there is existing Keycloak account with same email like identity provider. If no, create new user"; | ||
} | ||
|
||
@Override | ||
public boolean isUserSetupAllowed() { | ||
return false; | ||
} | ||
|
||
private static final List<ProviderConfigProperty> configProperties = new ArrayList<ProviderConfigProperty>(); | ||
|
||
static { | ||
//ProviderConfigProperty property; | ||
//configProperties.add(property); | ||
} | ||
|
||
|
||
@Override | ||
public List<ProviderConfigProperty> getConfigProperties() { | ||
return configProperties; | ||
} | ||
public static final String PROVIDER_ID = "bcgov-idp-create-user-if-unique"; | ||
static IdpCreateUserIfUniqueAuthenticator SINGLETON = new IdpCreateUserIfUniqueAuthenticator(); | ||
|
||
@Override | ||
public Authenticator create(KeycloakSession session) { | ||
return SINGLETON; | ||
} | ||
|
||
@Override | ||
public void init(Config.Scope config) {} | ||
|
||
@Override | ||
public void postInit(KeycloakSessionFactory factory) {} | ||
|
||
@Override | ||
public void close() {} | ||
|
||
@Override | ||
public String getId() { | ||
return PROVIDER_ID; | ||
} | ||
|
||
@Override | ||
public String getReferenceCategory() { | ||
return "createUserIfUnique"; | ||
} | ||
|
||
@Override | ||
public boolean isConfigurable() { | ||
return false; | ||
} | ||
|
||
public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = { | ||
AuthenticationExecutionModel.Requirement.ALTERNATIVE, | ||
AuthenticationExecutionModel.Requirement.REQUIRED, | ||
AuthenticationExecutionModel.Requirement.DISABLED | ||
}; | ||
|
||
@Override | ||
public AuthenticationExecutionModel.Requirement[] getRequirementChoices() { | ||
return REQUIREMENT_CHOICES; | ||
} | ||
|
||
@Override | ||
public String getDisplayType() { | ||
return "Create User If Unique (BCGOV)"; | ||
} | ||
|
||
@Override | ||
public String getHelpText() { | ||
return "Detect if there is existing Keycloak account with same email like identity provider. If no, create new user"; | ||
} | ||
|
||
@Override | ||
public boolean isUserSetupAllowed() { | ||
return false; | ||
} | ||
|
||
private static final List<ProviderConfigProperty> configProperties = | ||
new ArrayList<ProviderConfigProperty>(); | ||
|
||
static { | ||
// ProviderConfigProperty property; | ||
// configProperties.add(property); | ||
} | ||
|
||
@Override | ||
public List<ProviderConfigProperty> getConfigProperties() { | ||
return configProperties; | ||
} | ||
} |
Oops, something went wrong.