private DigestAuthHandler() throws Exception { digestAuthenticator = new DigestAuthenticator(); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); final HashLoginService hashLoginService = new HashLoginService("realm", "src/test/resources/TestInvokeHttp/realm.properties"); hashLoginService.start(); securityHandler.setLoginService(hashLoginService); securityHandler.setIdentityService(new DefaultIdentityService()); digestAuthenticator.setConfiguration(securityHandler); }
@Override protected IdentityService getHandlerIdentityService() { if (identityService == null) { identityService = new DefaultIdentityService(); } return identityService; }
@Override protected IdentityService getHandlerIdentityService() { if (identityService == null) { identityService = new DefaultIdentityService(); } return identityService; }
@Override public IdentityService getHandlerIdentityService() { return new DefaultIdentityService(); }
setIdentityService(new DefaultIdentityService()); manage(_identityService);
/** * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() */ @Override protected void doStart() throws Exception { if (identityService == null) { identityService = new DefaultIdentityService(); } super.doStart(); }
/** * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() */ protected void doStart() throws Exception { if (_identityService==null) _identityService=new DefaultIdentityService(); super.doStart(); }
/** * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart() */ protected void doStart() throws Exception { if (_identityService==null) _identityService=new DefaultIdentityService(); super.doStart(); }
@Override public IdentityService getHandlerIdentityService() { return new DefaultIdentityService(); }
public DrillSpnegoLoginService(DrillbitContext drillBitContext) throws DrillException { super(DrillSpnegoLoginService.class.getName()); setIdentityService(new DefaultIdentityService()); drillContext = drillBitContext; // Load and verify SPNEGO config. Then Login using creds to get an UGI instance spnegoConfig = new SpnegoConfig(drillBitContext.getConfig()); spnegoConfig.validateSpnegoConfig(); loggedInUgi = spnegoConfig.getLoggedInUgi(); }
/** Create a Jetty {@link SecurityHandler} for basic authentication. * See {@linkplain #addPathConstraint(ConstraintSecurityHandler, String)} * for adding the {@code pathspec} to apply it to. */ public static ConstraintSecurityHandler makeSecurityHandler(String realm, UserStore userStore, String role, AuthScheme authMode) { // role can be "**" for any authenticated user. Objects.requireNonNull(userStore); Objects.requireNonNull(role); if ( authMode == null ) authMode = dftAuthMode; ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); IdentityService identService = new DefaultIdentityService(); securityHandler.setIdentityService(identService); // ---- HashLoginService HashLoginService loginService = new HashLoginService(realm); loginService.setUserStore(userStore); loginService.setIdentityService(identService); securityHandler.setLoginService(loginService); securityHandler.setAuthenticator( authMode == AuthScheme.BASIC ? new BasicAuthenticator() : new DigestAuthenticator() ); if ( realm != null ) securityHandler.setRealmName(realm); return securityHandler; }
/** Create a Jetty {@link SecurityHandler} for basic authentication. * See {@linkplain #addPathConstraint(ConstraintSecurityHandler, String)} * for adding the {@code pathspec} to apply it to. */ public static ConstraintSecurityHandler makeSecurityHandler(String realm, UserStore userStore, String role, AuthScheme authMode) { // role can be "**" for any authenticated user. Objects.requireNonNull(userStore); Objects.requireNonNull(role); if ( authMode == null ) authMode = dftAuthMode; ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); IdentityService identService = new DefaultIdentityService(); securityHandler.setIdentityService(identService); // ---- HashLoginService HashLoginService loginService = new HashLoginService(realm); loginService.setUserStore(userStore); loginService.setIdentityService(identService); securityHandler.setLoginService(loginService); securityHandler.setAuthenticator( authMode == AuthScheme.BASIC ? new BasicAuthenticator() : new DigestAuthenticator() ); if ( realm != null ) securityHandler.setRealmName(realm); return securityHandler; }
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
protected WebAppContext createContext() { final WebAppContext ctx = new WebAppContext(); ctx.setContextPath("/"); ctx.setWar(appBase); if(!Strings.isNullOrEmpty(webInfLocation)) { ctx.setDescriptor(webInfLocation); } // configure security to avoid err println "Null identity service, trying login service:" // but I've found no way to get rid of LoginService=xxx log on system err :( HashLoginService loginService = new HashLoginService(); loginService.setIdentityService(new DefaultIdentityService()); ctx.getSecurityHandler().setLoginService(loginService); ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService()); ctx.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStarting(LifeCycle event) { ctx.getServletContext().setInitParameter("restx.baseServerUri", baseUrl()); ctx.getServletContext().setInitParameter("restx.serverId", getServerId()); } }); return ctx; }
static ConstraintSecurityHandler createSecurityHandler(String realm, List<String> roles) { final ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); Constraint constraint = new Constraint(); constraint.setAuthenticate(true); constraint.setRoles(roles.toArray(new String[0])); ConstraintMapping constraintMapping = new ConstraintMapping(); constraintMapping.setConstraint(constraint); constraintMapping.setMethod("*"); constraintMapping.setPathSpec("/*"); securityHandler.addConstraintMapping(constraintMapping); securityHandler.setAuthenticator(new BasicAuthenticator()); securityHandler.setLoginService(new JAASLoginService(realm)); securityHandler.setIdentityService(new DefaultIdentityService()); securityHandler.setRealmName(realm); return securityHandler; }
static ConstraintSecurityHandler createSecurityHandler(String realm, List<String> roles) { final ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); Constraint constraint = new Constraint(); constraint.setAuthenticate(true); constraint.setRoles(roles.toArray(new String[0])); ConstraintMapping constraintMapping = new ConstraintMapping(); constraintMapping.setConstraint(constraint); constraintMapping.setMethod("*"); constraintMapping.setPathSpec("/*"); securityHandler.addConstraintMapping(constraintMapping); securityHandler.setAuthenticator(new BasicAuthenticator()); securityHandler.setLoginService(new JAASLoginService(realm)); securityHandler.setIdentityService(new DefaultIdentityService()); securityHandler.setRealmName(realm); return securityHandler; }
private static void security(ServletContextHandler context, String authfile) { Constraint constraint = new Constraint() ; constraint.setName(Constraint.__BASIC_AUTH) ; constraint.setRoles(new String[]{"fuseki"}) ; constraint.setAuthenticate(true) ; ConstraintMapping mapping = new ConstraintMapping() ; mapping.setConstraint(constraint) ; mapping.setPathSpec("/*") ; IdentityService identService = new DefaultIdentityService() ; ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler() ; securityHandler.addConstraintMapping(mapping) ; securityHandler.setIdentityService(identService) ; HashLoginService loginService = new HashLoginService("Fuseki Authentication", authfile) ; loginService.setIdentityService(identService) ; securityHandler.setLoginService(loginService) ; securityHandler.setAuthenticator(new BasicAuthenticator()) ; context.setSecurityHandler(securityHandler) ; serverLog.debug("Basic Auth Configuration = " + authfile) ; }
private static void security(ServletContextHandler context, String authfile) { Constraint constraint = new Constraint() ; constraint.setName(Constraint.__BASIC_AUTH) ; constraint.setRoles(new String[]{"fuseki"}) ; constraint.setAuthenticate(true) ; ConstraintMapping mapping = new ConstraintMapping() ; mapping.setConstraint(constraint) ; mapping.setPathSpec("/*") ; IdentityService identService = new DefaultIdentityService() ; ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler() ; securityHandler.addConstraintMapping(mapping) ; securityHandler.setIdentityService(identService) ; HashLoginService loginService = new HashLoginService("Fuseki Authentication", authfile) ; loginService.setIdentityService(identService) ; securityHandler.setLoginService(loginService) ; securityHandler.setAuthenticator(new BasicAuthenticator()) ; context.setSecurityHandler(securityHandler) ; serverLog.debug("Basic Auth Configuration = " + authfile) ; }
private static Handler getSecuredHandler(final Handler handler, final String login, final String password) { final SecurityHandler securityHandler = new DummySecurityHandler(login); securityHandler.setAuthenticator(new BasicAuthenticator()); securityHandler.setIdentityService(new DefaultIdentityService()); securityHandler.setLoginService(new DummyLoginService(login, password)); securityHandler.setHandler(handler); return securityHandler; }