Package javax.security.auth

Examples of javax.security.auth.Subject


                                     Integer loadOnStartup,
                                     Set servletMappings,
                                     String runAsRole,
                                     WebServiceContainerFactory webServiceContainerFactory,
                                     JettyServletRegistration context) throws Exception {
        Subject runAsSubject = context == null? null: context.getSubjectForRole(runAsRole);
        servletHolder = new InternalJettyServletHolder(context == null? null: context.getLifecycleChain(), runAsSubject, context);
        //context will be null only for use as "default servlet info holder" in deployer.

        this.pojoClassName = pojoClassName;
        this.context = context;
View Full Code Here


            if (log.isDebugEnabled())
                log.debug("Login context created " + username);

            // Negotiate a login via this LoginContext
            Subject subject = loginContext.getSubject();
            ContextManager.setCallers(subject, subject);
            if (log.isDebugEnabled())
                log.debug(sm.getString("jaasRealm.loginContextCreated", username));

            // Return the appropriate Principal for this authenticated Subject
View Full Code Here

        options.put(JaasLoginModuleUse.KERNEL_NAME_LM_OPTION, kernel.getKernelName());
        if (!options.containsKey(JaasLoginModuleUse.CLASSLOADER_LM_OPTION)) {
            options.put(JaasLoginModuleUse.CLASSLOADER_LM_OPTION, module.getClass().getClassLoader());
        }
        options.put(JaasLoginModuleUse.SERVERINFO_LM_OPTION, server.getServerInfo());
        Subject sub = new Subject();
        CallbackHandler handler = new CallbackHandler() {
            public void handle(Callback[] callbacks) throws UnsupportedCallbackException {
                for (int i = 0; i < callbacks.length; i++) {
                    Callback callback = callbacks[i];
                    if (callback instanceof PasswordCallback) {
View Full Code Here

                                         Response response,
                                         SecurityConstraint[] constraints)
            throws IOException {

        //Get an authenticated subject, if there is one
        Subject subject = null;
        try {

            //We will use the PolicyContextHandlerContainerSubject.HANDLER_KEY to see if a user
            //has authenticated, since a request.getUserPrincipal() will not pick up the user
            //unless its using a cached session.
View Full Code Here

        // Which user principal have we already authenticated?
        Principal principal = request.getUserPrincipal();

        //If we have no principal, then we should use the default.
        if (principal == null) {
            Subject defaultSubject = (Subject) request.getAttribute(PolicyContextBeforeAfter.DEFAULT_SUBJECT);
            ContextManager.setCallers(defaultSubject, defaultSubject);
        } else {
            Subject currentCaller = ((JAASTomcatPrincipal) principal).getSubject();
            ContextManager.setCallers(currentCaller, currentCaller);
        }

        try {
View Full Code Here

        if (name == null || name.equals("jsp")) {
            name = "";
        }

        //Set the caller
        Subject currentCaller = ((JAASTomcatPrincipal) principal).getSubject();
        ContextManager.setCallers(currentCaller, currentCaller);

        AccessControlContext acc = ContextManager.getCurrentContext();

        try {
View Full Code Here

        String moduleID = newContext.getDeploymentInfo().getModuleID();
        PolicyContext.setContextID(moduleID);

        // set the default subject if needed
        if (ContextManager.getCurrentCaller() == null) {
            Subject defaultSubject = ejbDeployment.getDefaultSubject();

            if (defaultSubject != null) {
                ContextManager.setCallers(defaultSubject, defaultSubject);
                geronimoCallContext.clearCallers = true;
            }
        }

        // apply run as
        Subject runAsSubject = ejbDeployment.getRunAs();
        geronimoCallContext.callers = ContextManager.pushNextCaller(runAsSubject);

        newContext.set(GeronimoCallContext.class, geronimoCallContext);
    }
View Full Code Here

        JettySecurityHandler securityHandler = null;
        if (securityRealmName != null) {
            InternalJAASJettyRealm internalJAASJettyRealm = jettyContainer.addRealm(securityRealmName);
            //wrap jetty realm with something that knows the dumb realmName
            JAASJettyRealm realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
            Subject defaultSubject =  this.runAsSource.getDefaultSubject();
            securityHandler = new JettySecurityHandler(authenticator, realm, policyContextID, defaultSubject);
        }

        ServletHandler servletHandler = new ServletHandler();
View Full Code Here

    }

    public Object login(String securityRealm, String user, String pass) throws LoginException {
        LoginContext context = ContextManager.login(securityRealm, new UsernamePasswordCallbackHandler(user, pass));

        Subject subject = context.getSubject();
        return ContextManager.getSubjectId(subject);
    }
View Full Code Here

        Subject subject = context.getSubject();
        return ContextManager.getSubjectId(subject);
    }

    public void logout(Object securityIdentity) {
        Subject subject = ContextManager.getRegisteredSubject((SubjectId) securityIdentity);
        ContextManager.unregisterSubject(subject);
    }
View Full Code Here

TOP

Related Classes of javax.security.auth.Subject

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.