[Security & JAAS/JBoss] - The neverending logout topic
by chakotey07
Dear community,
I am rather new to the JbossSX / JAAS topic and thus, I searched the forum to understand my problems, but I am not sure if I got everthing right.
Scenario:
I successfully secured a test web application via my custom login module and declarative security. Wonderful, but regarding the logout of an authenticated subject I got some problems / questions.
Question 1:
I first used Basic Auth ... read the solution within the forum that session.invalidate does not work.
Thus, I switched to Form Auth (incl. j_security_check) ... session.invalidate does not work neither. Wrong ... it works, but the browser caches the credentials and performs itself a re-login (right?). Is there any other (easy / designated) solution than restarting the browser?
Question 1a:
I read that the manually invocation of the Basic Auth Popup is not possible, ok. Is this possible using Form Auth?
If yes, then I could store an logout-attribute, check this at each page call and so I'd have a workaround regarding the browser's credential caching...
Question 2:
Is there a possibility to retreive the current LoginContext (although I didn't create the LoginContext instance within my code) in order to manually perform the logout method of my custom login module?
I'd be so glad for helpful suggestions and solutions - and please don't damn me, if I missed an existing solution-topic and thus didn't read it :-/
Thx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037586#4037586
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037586
19 years
[JBoss Seam] - Re: Seam Email - IllegalStateException: No Factories configu
by KoniKoni
No,
code:
Session:
import kk.rentform.session.mailprocessor.AsynchronousMailProcessor;
|
| @Name("regist")
| @Scope(ScopeType.CONVERSATION)
| @Stateless
| public class Regist implements RegistInterface{
| @In
| private Usr usr;
|
| @PersistenceContext
| private EntityManager em;
|
| @In
| private FacesMessages facesMessages;
|
| @Logger
| private Log log;
|
| @In
| private AsynchronousMailProcessor asynchronousMailProcessor;
|
| @In
| private Crypt crypt;
|
| public String regist(){
| if ( ! usr.getPasswort().equals(usr.getPasswort1()) ){
| facesMessages.add("Passwörter sind nicht gleich!");
| return null;
| }
|
|
|
| List ls = em.createQuery("select u.email from Usr u where u.email = :email")
| .setParameter("email",usr.getEmail())
| .getResultList();
|
| if ( !ls.isEmpty() ){
| facesMessages.add("Email Adresse existiert bereits!");
| return null;
| }
|
| List lsb = em.createQuery("select u.bname from Usr u where u.bname = :bname")
| .setParameter("bname",usr.getBname())
| .getResultList();
| if ( !lsb.isEmpty() ){
| facesMessages.add("Benutzername existiert bereits!");
| return null;
| }
| usr.setActive(false);
| usr.setSperr(false);
| String zf = crypt.generate();
| usr.setGennumber(zf);
| usr.setRoles("user");
| try{
| em.persist(usr);
| asynchronousMailProcessor.scheduleSend(3000, usr);
| return "/registok.xhtml";
|
| }catch(Exception e){
| log.error("---------------- Error : " + e.getMessage());
| log.error(e.getStackTrace());
| facesMessages.add("Registrierung fehlgeschlagen, versuchen es später nochmal.");
| return null;
| }
|
|
| }
|
| }
|
I use this a class from example:
| import kk.rentform.entity.Usr;
| import org.jboss.seam.annotations.Asynchronous;
| import org.jboss.seam.annotations.AutoCreate;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.timer.Duration;
| import org.jboss.seam.contexts.Contexts;
| import org.jboss.seam.core.Events;
| import org.jboss.seam.core.Renderer;
|
| @Name("asynchronousMailProcessor")
| @AutoCreate
| public class AsynchronousMailProcessor
| {
| @Asynchronous
| public void scheduleSend(@Duration long delay,Usr usr) {
| try {
| Contexts.getEventContext().set("usr", usr);
| Renderer.instance().render("/emailtemplates/registmsg.xhtml");
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
|
| <m:message xmlns="http://www.w3.org/1999/xhtml"
| xmlns:m="http://jboss.com/products/seam/mail"
| xmlns:h="http://java.sun.com/jsf/html">
|
| <m:from name="xxx" address="xxx" />
| <m:to name="#{usr.firma}"> #{usr.email}</m:to>
| <m:subject>Registrierung</m:subject>
| <m:body>
| <p>Sehr geehrte Damen und Herren,</p>
|
| <p>Um Ihre Registrierung bei rentform.de vervollständigen zu können, ist es notwendig Ihren Account freizuschalten.</p>
| <p>Klicken Sie auf den folgenden Link: </p>
|
| <p>Klicken Sie auf den folgenden Link: </p>
|
| <p>Peter</p>
| </m:body>
| </m:message>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037584#4037584
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037584
19 years
[JBoss Seam] - EntityNotFoundException when performing EntityManager.refres
by waynebagguley
Here is my scenario. I have an entity bean 'Request' that has a list of entity beans 'Detail'. I use the @OneToMany(cascade=ALL) annotation for the relationship.
I have a page where I can edit 'Request' and add 'Detail' objects to it. If I click 'save' then everything is saved perfectly. If I hit 'discard' then I try and call:entityManager.refresh(request);so that the details are reverted back to the database. If I don't add any 'Detail' objects, it works, but if I do add them and then click 'discard' I get this exception:
javax.persistence.EntityNotFoundException: No row with the given identifier exists
I am using
@Begin(flushMode=FlushModeType.MANUAL)
on the initial method and
@End
on the discard method.
I guess that this is because the newly created Detail objects don't exist in the database, but I thought that calling the refresh method would take this possibility into account?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037583#4037583
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037583
19 years
[JBoss Seam] - Re: Seam Email - IllegalStateException: No Factories configu
by KoniKoni
Hello, i get the same exception:
| 16:40:42,818 ERROR [STDERR] java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
| If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
| A typical config looks like this;
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
| 16:40:42,818 ERROR [STDERR] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
| 16:40:42,818 ERROR [STDERR] at org.jboss.seam.mock.MockFacesContext.<init>(MockFacesContext.java:62)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer$Context.wrap(FaceletsRenderer.java:59)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:110)
| 16:40:42,819 ERROR [STDERR] at kk.rentform.session.mailprocessor.AsynchronousMailProcessor.scheduleSend(AsynchronousMailProcessor.java:20)
| 16:40:42,819 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 16:40:42,819 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 16:40:42,819 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 16:40:42,819 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.interceptors.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:37)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
| 16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
| 16:40:42,820 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
| 16:40:42,820 ERROR [STDERR] at kk.rentform.session.mailprocessor.AsynchronousMailProcessor_$$_javassist_89.scheduleSend(AsynchronousMailProcessor_$$_javassist_89.java)16:40:42,820 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 16:40:42,820 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 16:40:42,820 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 16:40:42,820 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
| 16:40:42,820 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
| 16:40:42,820 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
|
I use jboss 4.0.5GA + Jboss Seam build tonight.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037578#4037578
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037578
19 years