Examples of BasicAuthenticationPrincipal


Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

        String username = null;
        String password = null;
       
        // get the security context
        Subject subject = SecurityUtil.getSubject(msg);
        BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
                                                                           BasicAuthenticationPrincipal.class);

        // could use the security principal to look up basic auth credentials
        if principal != null ) {
            username = ((BasicAuthenticationPrincipal)principal).getName();
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

            }
        }
       
        // get the security context
        Subject subject = SecurityUtil.getSubject(msg);
        BasicAuthenticationPrincipal principal =  new BasicAuthenticationPrincipal(username,
                                                                                   password);
        subject.getPrincipals().add(principal);
    }   
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

        String username = null;
        String password = null;
       
        // get the security context
        Subject subject = SecurityUtil.getSubject(msg);
        BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
                                                                           BasicAuthenticationPrincipal.class);

        // could use the security principal to look up basic auth credentials
        if principal != null ) {
            username = ((BasicAuthenticationPrincipal)principal).getName();
            password = ((BasicAuthenticationPrincipal)principal).getPassword();
        } else if (policy != null ){
            username = policy.getUserName();
            password = policy.getPassword();
           
            principal = new BasicAuthenticationPrincipal(username,
                                                         password);
            subject.getPrincipals().add(principal);
        }       
       
        if (username == null || password == null ){
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

            }
        }
       
        // get the security context
        Subject subject = SecurityUtil.getSubject(msg);
        BasicAuthenticationPrincipal principal =  new BasicAuthenticationPrincipal(username,
                                                                                   password);
        subject.getPrincipals().add(principal);
   
        return getNext().invoke(msg);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

        String username = null;
        String password = null;
       
        // get the security context
        Subject subject = SecurityUtil.getSubject(msg);
        BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
                                                                           BasicAuthenticationPrincipal.class);

        // could use the security principal to look up basic auth credentials
        if principal != null ) {
            username = ((BasicAuthenticationPrincipal)principal).getName();
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

            }
        }
       
        // get the security context
        Subject subject = SecurityUtil.getSubject(msg);
        BasicAuthenticationPrincipal principal = null;
        try {
            principal =  new BasicAuthenticationPrincipal(username,
                                                          password);
        } catch (Exception ex) {
            // null test will throw a suitable exceptions
        }
       
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

    public LDAPRealmAuthenticationCallbackHandler(Subject subject) {
        this.subject = subject;
    }
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

        BasicAuthenticationPrincipal principal =  SecurityUtil.getPrincipal(subject, BasicAuthenticationPrincipal.class);

        if (principal != null){
          /*
            System.out.println(">>> LDAPRealmAuthenticationCallbackHandler" +
                               " Username: " + principal.getName() +
                               " Password: " + principal.getPassword());
            */
            for (int i = 0; i < callbacks.length; i++) {
                if (callbacks[i] instanceof NameCallback) {
                    NameCallback nc = (NameCallback)callbacks[i];
                    nc.setName(principal.getName());
                } else if (callbacks[i] instanceof PasswordCallback) {
                    PasswordCallback pc = (PasswordCallback)callbacks[i];
                    pc.setPassword(principal.getPassword().toCharArray());
                } else {
                    throw new UnsupportedCallbackException
                    (callbacks[i], "Unsupported Callback!");
                }
            }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

                }
            }
        }

        if(user != null && password != null) {
            BasicAuthenticationPrincipal principal = new BasicAuthenticationPrincipal(user, password);
            subject.getPrincipals().add(principal);
        }
       
        return subject;
    }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

    public LDAPRealmAuthenticationCallbackHandler(Subject subject) {
        this.subject = subject;
    }
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

        BasicAuthenticationPrincipal principal =  SecurityUtil.getPrincipal(subject, BasicAuthenticationPrincipal.class);

        if (principal != null){
            System.out.println(">>> LDAPRealmAuthenticationCallbackHandler" +
                               " Username: " + principal.getName() +
                               " Password: " + principal.getPassword());
           
            for (int i = 0; i < callbacks.length; i++) {
                if (callbacks[i] instanceof NameCallback) {
                    NameCallback nc = (NameCallback)callbacks[i];
                    nc.setName(principal.getName());
                } else if (callbacks[i] instanceof PasswordCallback) {
                    PasswordCallback pc = (PasswordCallback)callbacks[i];
                    pc.setPassword(principal.getPassword().toCharArray());
                } else {
                    throw new UnsupportedCallbackException
                    (callbacks[i], "Unsupported Callback!");
                }
            }
View Full Code Here

Examples of org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal

                }
            }
        }

        if(user != null && password != null) {
            BasicAuthenticationPrincipal principal = new BasicAuthenticationPrincipal(user, password);
            subject.getPrincipals().add(principal);
        }
       
        return subject;
    }
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.