Merge pull request #2917 from thomasdarimont/issue/KEYCLOAK-3054-fix-npe-on-unknown-protocol
KEYCLOAK-3054: Fix potential NPE in RealmsResource
This commit is contained in:
commit
b6a76b1267
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