Examples of WebPrincipal


Examples of com.sun.enterprise.security.web.integration.WebPrincipal

        //set the appropriate security context
        loginForRunAs(username);
        SecurityContext secCtx = SecurityContext.getCurrent();
        _logger.log(Level.FINE, "Security context is " + secCtx);
        assert (secCtx != null);
        Principal principal = new WebPrincipal(username, (char[])null, secCtx);
        _logger.log(Level.INFO, "Principal created for FailOvered user " + principal);
        return principal;
    }
View Full Code Here

Examples of com.sun.enterprise.security.web.integration.WebPrincipal

                !principalSetContainsOnlyAnonymousPrincipal(principalSet)) {

                SecurityContext ctx = new SecurityContext(subject);
                //XXX assuming no null principal here
                Principal p = ctx.getCallerPrincipal();
                WebPrincipal wp = new WebPrincipal(p, ctx);
                try {
                    //XXX Keep it for reference
                    /*
                    if (this.sAC.managesSessions(sharedState)) {
                    // registration (via proxy) does not occur
View Full Code Here

Examples of com.sun.enterprise.security.web.integration.WebPrincipal

        // to work as expected.

        SecurityContext secCtx = SecurityContext.getCurrent();
        assert (secCtx != null); // since login succeeded above

        WebPrincipal principal = new WebPrincipal(user, password, secCtx);
        req.setUserPrincipal(principal);
        req.setAuthType(WEBAUTH_PROGRAMMATIC);

        if(logger.isLoggable(Level.FINE)){
            logger.log(Level.FINE, "Programmatic login set principal in http request to: "+
View Full Code Here

Examples of com.sun.web.security.WebPrincipal

        // This could be an EJB endpoint; check the threadlocal variable
        Switch sw = Switch.getSwitch();
        InvocationManager mgr = sw.getInvocationManager();
        Object o = mgr.getCurrentInvocation().getContainerContext();
        if (o instanceof StatelessSessionContainer) {
            WebPrincipal p = (WebPrincipal) principal.get();
            if (p != null) {
                return p;
            }
        }
        //This is a servlet endpoint
View Full Code Here

Examples of com.sun.web.security.WebPrincipal

        String method = hreq.getMethod();
        if( method.equals("GET") || !endpoint.hasAuthMethod() ) {
            return true;
        }
       
        WebPrincipal webPrincipal = null;
        String endpointName = endpoint.getEndpointName();
       
        if( endpoint.hasBasicAuth() ) {
            String rawAuthInfo = hreq.getHeader(AUTHORIZATION_HEADER);
            if (rawAuthInfo==null) {
                sendAuthenticationEvents(false, hreq.getRequestURI(), null);
                return false;
            }
           
            String[] usernamePassword =
                    parseUsernameAndPassword(rawAuthInfo);
            if( usernamePassword != null ) {
                webPrincipal = new WebPrincipal
                        (usernamePassword[0], usernamePassword[1], SecurityContext.init());
            } else {
                logger.log(Level.WARNING, "BASIC AUTH username/password " +
                           "http header parsing error for " + endpointName);
            }
        } else {

            X509Certificate certs[] (X509Certificate[]) hreq.getAttribute(Globals.CERTIFICATES_ATTR);
            if ((certs == null) || (certs.length < 1)) {
                certs = (X509Certificate[])
                    hreq.getAttribute(Globals.SSL_CERTIFICATE_ATTR);
            }

            if( certs != null ) {
                webPrincipal = new WebPrincipal(certs, SecurityContext.init());
            } else {
                logger.log(Level.WARNING, "CLIENT CERT authentication error for " + endpointName);
            }

        }
View Full Code Here

Examples of com.sun.web.security.WebPrincipal

    public Subject getSubject(Principal principal) {
        SecurityContext secContext = null;
        if (principal != null) {
            if (principal instanceof WebPrincipal) {
                WebPrincipal wp = (WebPrincipal) principal;
                secContext = wp.getSecurityContext();
            } else {
                secContext = new SecurityContext(principal.getName(), null);
            }
        }
        if (secContext == null) {
View Full Code Here

Examples of com.sun.web.security.WebPrincipal

            LoginContextDriver.login(creds);
            if(!rp.validateAndCacheNonce(new StringNonce(request.getCallId()))){
                throw new SecurityException("Identity Authentication failed");
            }
            SecurityContext secCtx = SecurityContext.getCurrent();
            return new WebPrincipal(creds.getUserName(), null, secCtx);          
        } catch (LoginException le) {

            securityLogger.log(Level.SEVERE, "Identity Authentication failed", le);
            throw new SecurityException("Identity Authentication failed");
View Full Code Here

Examples of com.sun.web.security.WebPrincipal

                public java.lang.Object run() {
                    try {
                        LoginContextDriver.login(creds);
                        SecurityContext secCtx = SecurityContext.getCurrent();
                        secCtx.getSubject().getPrivateCredentials().add(ap);
                        return new WebPrincipal(creds.getUserName(), null, secCtx);
                    } catch (LoginException ex) {
                        securityLogger.log(Level.SEVERE, "P-Asserted Authentication failed", ex);
                        throw new SecurityException("P-Asserted Authentication failed");
                    }
                }
View Full Code Here

Examples of com.sun.web.security.WebPrincipal


            authInfoHeader = createAuthInfoHeader(request, nextNonce);
            SecurityContext secCtx = SecurityContext.getCurrent();

            return new WebPrincipal(creds.getUserName(), null, secCtx);
        } catch (Exception le) {
            logger.log(Level.SEVERE, "Digest Authentication failed", le);

        //TODO: Log
        }
View Full Code Here

Examples of com.sun.web.security.WebPrincipal

    public static Subject getSubject(Principal principal) {
        SecurityContext secContext = null;
        if (principal != null) {
            if (principal instanceof WebPrincipal) {
                WebPrincipal wp = (WebPrincipal) principal;
                secContext = wp.getSecurityContext();
            } else {
                secContext = new SecurityContext(principal.getName(), null);
            }
        }
        if (secContext == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.