KEYCLOAK-3054: Fix potential NPE in RealmsResource
Prior to PR .well-known Endpoint threw NPE with if unknown Protocol was provided.
This commit is contained in:
parent
816b01860b
commit
67a63a806e
1 changed files with 6 additions and 1 deletions
|
@ -98,9 +98,14 @@ public class RealmsResource {
|
|||
final @PathParam("protocol") String protocol) {
|
||||
RealmModel realm = init(name);
|
||||
|
||||
LoginProtocolFactory factory = (LoginProtocolFactory)session.getKeycloakSessionFactory().getProviderFactory(LoginProtocol.class, protocol);
|
||||
if(factory == null){
|
||||
logger.debugv("protocol %s not found", protocol);
|
||||
throw new NotFoundException("Protocol not found");
|
||||
}
|
||||
|
||||
EventBuilder event = new EventBuilder(realm, session, clientConnection);
|
||||
|
||||
LoginProtocolFactory factory = (LoginProtocolFactory)session.getKeycloakSessionFactory().getProviderFactory(LoginProtocol.class, protocol);
|
||||
Object endpoint = factory.createProtocolEndpoint(realm, event);
|
||||
|
||||
ResteasyProviderFactory.getInstance().injectProperties(endpoint);
|
||||
|
|
Loading…
Reference in a new issue