Package org.eclipse.jetty.security

Examples of org.eclipse.jetty.security.LoginService


        // configured a webapp's web.xml and since it has a lifecycle of its own
        // we register it as a bean with the Jetty server object so it can be
        // started and stopped according to the lifecycle of the server itself.
        // In this example the name can be whatever you like since we are not
        // dealing with webapp realms.
        LoginService loginService = new HashLoginService("MyRealm",
                "src/test/resources/realm.properties");
        server.addBean(loginService);

        // A security handler is a jetty handler that secures content behind a
        // particular portion of a url space. The ConstraintSecurityHandler is a
View Full Code Here


        result = DatabaseLoginServiceTestServer.runscript(scriptFile);
        assertThat("runScript result",result, is(0));
       
        File jdbcRealmFile = MavenTestingUtils.getTestResourceFile("jdbcrealm.properties");
       
        LoginService loginService = new JDBCLoginService(__realm, jdbcRealmFile.getAbsolutePath());
        _testServer = new DatabaseLoginServiceTestServer();
        _testServer.setResourceBase(_docRoot.getAbsolutePath());
        _testServer.setLoginService(loginService);
        _testServer.start();
        _baseUri = _testServer.getBaseUri();
View Full Code Here

        stream.defaultReadObject();
       
        SecurityHandler security=SecurityHandler.getCurrentSecurityHandler();
        if (security==null)
            throw new IllegalStateException("!SecurityHandler");
        LoginService login_service=security.getLoginService();
        if (login_service==null)
            throw new IllegalStateException("!LoginService");
       
        _userIdentity=login_service.login(_name,_credentials);
        LOG.debug("Deserialized and relogged in {}",this);
    }
View Full Code Here

            Permissions unchecked = new Permissions();
            unchecked.add(new WebUserDataPermission("/", null));
            unchecked.add(new WebResourcePermission("/", ""));
            ComponentPermissions componentPermissions = new ComponentPermissions(new Permissions(), unchecked, Collections.<String, PermissionCollection>emptyMap());
            setUpJACC(Collections.<String, SubjectInfo>emptyMap(), Collections.<Principal, Set<String>>emptyMap(), componentPermissions, policyContextId);
            LoginService loginService = newLoginService();
//            final ServletCallbackHandler callbackHandler = new ServletCallbackHandler(loginService);
            final Subject subject = new Subject();
            final AccessControlContext acc = ContextManager.registerSubjectShort(subject, null, null);
            securityHandlerFactory = new ServerAuthenticationGBean(new Authenticator() {
                public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException {
View Full Code Here

    }

    protected WebAppContextWrapper setUpSecureAppContext(String securityRealmName, Map<String, SubjectInfo> roleDesignates, Map<Principal, Set<String>> principalRoleMap, ComponentPermissions componentPermissions, SubjectInfo defaultSubjectInfo, PermissionCollection checked, Set securityRoles) throws Exception {
        String policyContextId = "TEST";
        ApplicationPolicyConfigurationManager jacc = setUpJACC(roleDesignates, principalRoleMap, componentPermissions, policyContextId);
        LoginService loginService = newLoginService();
        Authenticator serverAuthentication = new FormAuthenticator("/auth/logon.html?param=test", "/auth/logonError.html?param=test", true);
        SecurityHandlerFactory securityHandlerFactory = new ServerAuthenticationGBean(serverAuthentication, loginService);
        return setUpAppContext(
                securityRealmName,
                securityHandlerFactory,
View Full Code Here

        this.realmName = realmName;
        this.configurationFactory = configurationFactory;
    }

    public SecurityHandler buildSecurityHandler(String policyContextID, Subject defaultSubject, RunAsSource runAsSource, boolean checkRolePermissions) {
        final LoginService loginService = new JAASLoginService(configurationFactory, realmName);
        Authenticator authenticator = buildAuthenticator();
        if (defaultSubject == null) {
            defaultSubject = ContextManager.EMPTY;
        }
        AccessControlContext defaultAcc = ContextManager.registerSubjectShort(defaultSubject, null, null);
View Full Code Here

                ConstraintSecurityHandler sh =
                        crossOriginOn ? new CrossOriginConstraintSecurityHandler() : new ConstraintSecurityHandler();
                sh.setAuthenticator(authenticator);
                sh.setConstraintMappings(Collections.singletonList(cm));

                LoginService loginService =
                        new SecurityServiceLoginService(securityService, login.getCredentialType(), loginCacheSeconds);
                sh.setLoginService(loginService);

                localRootContextHandler.setSecurityHandler(sh);
            }
View Full Code Here

    }

    protected void configureServer() throws Exception {
        URL resource = getClass()
            .getResource("jetty-realm.properties");
        LoginService realm =
            new HashLoginService("BookStoreRealm", resource.toString());
        server.addBean(realm);
    }
View Full Code Here

   
    @Override
    protected void configureServer(org.eclipse.jetty.server.Server server) throws Exception {
        URL resource = getClass()
            .getResource("/org/apache/cxf/systest/jaxrs/security/jetty-realm.properties");
        LoginService realm =
            new HashLoginService("BookStoreRealm", resource.toURI().getPath());
        server.addBean(realm);
    }
View Full Code Here

        {
            Authentication authentication = _authenticator.validateRequest(request,__deferredResponse,true);

            if (authentication!=null && (authentication instanceof Authentication.User) && !(authentication instanceof Authentication.ResponseSent))
            {
                LoginService login_service= _authenticator.getLoginService();
                IdentityService identity_service=login_service.getIdentityService();
               
                if (identity_service!=null)
                    _previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity());
               
                return authentication;
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.security.LoginService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.