|
Java EE 6 example source code file (MySecurityContext.java)
The Java EE 6 MySecurityContext.java source codepackage samples.connectors.mailconnector.ra.inbound; import org.glassfish.security.common.PrincipalImpl; import javax.security.auth.Subject; import javax.security.auth.message.callback.CallerPrincipalCallback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.Callback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.resource.spi.work.SecurityContext; import java.util.List; import java.util.ArrayList; import java.io.IOException; import java.util.logging.Logger; import javax.security.auth.message.callback.PasswordValidationCallback; /** * @author jagadish */ public class MySecurityContext extends SecurityContext { private String userName; private String password; private String principalName; private Subject subject; static Logger logger = Logger.getLogger("samples.connectors.mailconnector.ra.inbound"); public MySecurityContext(String userName, String password, String principalName){ this.userName = userName; this.password = password; this.principalName = principalName; logger.fine("[MySecurityContext] constructor"); } public void setupSecurityContext(CallbackHandler callbackHandler, Subject execSubject, Subject serviceSubject) { execSubject.getPrincipals().add(new PrincipalImpl(principalName)); List<Callback> callbacks = new ArrayList Other Java EE 6 examples (source code examples)Here is a short list of links related to this Java EE 6 MySecurityContext.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.