use of org.keycloak.authentication.Authenticator in project keycloak by keycloak.
the class AuthenticatorConfiguredMethod method exec.
@Override
public Object exec(List list) throws TemplateModelException {
String providerId = list.get(0).toString();
Authenticator authenticator = session.getProvider(Authenticator.class, providerId);
return authenticator.configuredFor(session, realm, user);
}
use of org.keycloak.authentication.Authenticator in project keycloak by keycloak.
the class ConditionalUserConfiguredAuthenticator method isConfiguredFor.
private boolean isConfiguredFor(AuthenticationExecutionModel model, AuthenticationFlowContext context) {
if (model.isAuthenticatorFlow()) {
return matchConditionInFlow(context, model.getId());
}
AuthenticatorFactory factory = (AuthenticatorFactory) context.getSession().getKeycloakSessionFactory().getProviderFactory(Authenticator.class, model.getAuthenticator());
Authenticator authenticator = factory.create(context.getSession());
return authenticator.configuredFor(context.getSession(), context.getRealm(), context.getUser());
}
use of org.keycloak.authentication.Authenticator in project keycloak by keycloak.
the class AuthenticationManagementResource method removeAuthenticatorConfig.
/**
* Delete authenticator configuration
* @param id Configuration id
*/
@Path("config/{id}")
@DELETE
@NoCache
public void removeAuthenticatorConfig(@PathParam("id") String id) {
auth.realm().requireManageRealm();
AuthenticatorConfigModel config = realm.getAuthenticatorConfigById(id);
if (config == null) {
throw new NotFoundException("Could not find authenticator config");
}
realm.getAuthenticationFlowsStream().forEach(flow -> realm.getAuthenticationExecutionsStream(flow.getId()).filter(exe -> Objects.equals(id, exe.getAuthenticatorConfig())).forEachOrdered(exe -> {
exe.setAuthenticatorConfig(null);
realm.updateAuthenticatorExecution(exe);
}));
realm.removeAuthenticatorConfig(config);
adminEvent.operation(OperationType.DELETE).resource(ResourceType.AUTHENTICATOR_CONFIG).resourcePath(session.getContext().getUri()).success();
}
Aggregations