[Security & JAAS/JBoss] - looking for working example: custom login module extends Use
by anthonykrinsky
I am looking for **working** sample code that extends UsernamePasswordLoginModule. The module I am trying to write needs to check for JBOSS authentication - if OK, proceed - and also do custom auth against a complex auth scheme which includes checking username, synchronizing users/groups, etc.
The code that I have written is properly invoked upon login, and I have visibility into the J_USERNAME and J_PASSWORD fields, however, commit is never called and the user is never granted access to my portal.
I have downloaded many examples from the internet but have been unable to get any of them to **work**. Probably my error, but there's no "cook-book" out there or samples that show how to do this unequivocally and repeatably.
For demonstration purposes, simply returning "true" from the login() function is sufficient.
Any help would be greatly appreciated.
THANKS!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110268#4110268
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110268
18 years, 4 months
[JBoss Seam] - ManyToMany association within conversation scope bean
by avpavlov
Hi all.
I have 2 entities linked via many-to-many association
| @Entity
| @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
| public class User implements Serializable {
| @Id
| @GeneratedValue
| private long id;
|
| @NotEmpty
| @Column(unique = true)
| private String username;
|
| @ManyToMany(cascade = CascadeType.ALL)
| @JoinTable(
| name="UserToProvider",
| joinColumns = { @JoinColumn( name="user_id") },
| inverseJoinColumns = @JoinColumn( name="provider_id")
| )
| private Collection<Provider> providers = new ArrayList<Provider>();
| }
|
| @Entity
| @Table(name="Provider" )
| @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
| public class Provider implements Serializable {
| @Id
| @GeneratedValue
| private int id;
| @NotNull
| private String UPI; //Unique Provider identifier
|
| @ManyToMany(mappedBy="providers", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
| private Collection<User> users;
| }
|
Users list displayed on Provider form
| ....
| <h:panelGrid title="Users">
| <ui:repeat var="user" value="#{providerFormAction.provider.users}">
| <h:commandLink value="#{user.firstName} #{user.lastName}" action="#{userFormAction.view(user)}"/>
| <br/>
| </ui:repeat>
| <h:commandButton action="#{userFormAction.addNew}" value="Add new"/>
|
| ...
|
|
userFormAction.addNew() and .view() methods are marked as starting nested conversation. Save() method finihes current converastion and restore parent.
| public class UserFormAction implements java.io.Serializable {
| @In
| EntityManager entityManager = null;
|
| @In
| Conversation conversation;
|
| private User user = null;
|
| @Begin(nested=true)
| public String addNew() {
| user = new User();
| return "/jspx/userForm.jspx";
| }
|
| @Begin(nested=true)
| public String view(User u) {
| user = u;
| return "/jspx/userForm.jspx";
| }
|
| public void save() {
| entityManager.persist(user);
|
| // tried flush - it did not help!!!
| // entityManager.flush();
|
| // to return to previous conversation
| conversation.endAndRedirect();
| }
|
| ....
|
After returning to Provider form it is still displaying OLD links (i.e. if I created new user linked to this provider - it is not displayed, if I removed link - it is still displayed as linked), although username is refreshed!
If I clear conversationId in browser address bar then links become correct.
Looks like marked as "mappedBy" end of many-to-many association is not refreshed properly in Seam - I tested other fields type - simple properties, ManyToOne, active end of ManyToMany - all refreshed properly OR I'M WRONG?.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110266#4110266
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110266
18 years, 4 months
[JBoss Seam] - Re: how does Seam/EJB determine session expiration?
by asookazian
running jboss 4.2.2.GA with Seam2.0.0.GA.
1) started JBoss and deployed my Seam app.
2) navigated to JBoss web-console via following URL: http://localhost:8080/web-console/ and navigated to monitoring --> web status --> full status
3) checked active sessions and session count for my app were both zero.
4) launched IE browser and navigated to following URL: http://localhost:8080/securityAudit/
5) launched IE browser again and navigated to same URL as step 4.
6) refreshed web-console
7) results:
localhost/securityAudit
Start time: Tue Dec 04 08:50:07 PST 2007 Startup time: 31 ms TLD scan time: 0 ms
Active sessions: 2 Session count: 2 Max active sessions: 2 Rejected session creations: 0 Expired sessions: 0 Longest session alive time: 0 s Average session alive time: 0 s Processing time: 0 ms
JSPs loaded: 0 JSPs reloaded: 0
8) closed both IE browsers and refreshed the full status in web-console.
9) results (the same as step 7):
localhost/securityAudit
Start time: Tue Dec 04 08:50:07 PST 2007 Startup time: 31 ms TLD scan time: 0 ms
Active sessions: 2 Session count: 2 Max active sessions: 2 Rejected session creations: 0 Expired sessions: 0 Longest session alive time: 0 s Average session alive time: 0 s Processing time: 0 ms
JSPs loaded: 0 JSPs reloaded: 0
So it seems the sessions are still active obviously... The other reason I know is that the prePassivate output in the log does not occur when I close the browser(s).
HTTP is a stateless protocol and this experiment proves it... When I restart the JBoss server, the session count goes to zero again...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110258#4110258
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110258
18 years, 4 months
[Persistence, JBoss/CMP, Hibernate, Database] - Message persistence Exception
by paradisonoir
While I was working with my Jboss Application server (jboss-4.0.5.GA), I face this error when size of my demand exceeded 2.5 M.B.
Do you have any idea why I receive such an exception?
thanks,
18:17:09,500 WARN [JDBCPersistenceManager] Trying again after a pause
18:17:09,781 WARN [JDBCPersistenceManager] SQLException caught - assuming deadl
ock detected, try:17
java.sql.SQLException: Unique constraint violation: in statement [INSERT INTO J
MS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, P
AYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINA
TION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?)]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdat
e(WrappedPreparedStatement.java:251)
at org.jboss.messaging.core.plugin.JDBCPersistenceManager.updateWithRetr
y(JDBCPersistenceManager.java:4384)
at org.jboss.messaging.core.plugin.JDBCPersistenceManager.updateWithRetr
y(JDBCPersistenceManager.java:4356)
at org.jboss.messaging.core.plugin.JDBCPersistenceManager.addReference(J
DBCPersistenceManager.java:1651)
at org.jboss.messaging.core.ChannelSupport.handleInternal(ChannelSupport
.java:833)
at org.jboss.messaging.core.ChannelSupport$HandleRunnable.run(ChannelSup
port.java:1732)
at EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run(QueuedExe
cutor.java:89)
at java.lang.Thread.run(Thread.java:595)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110256#4110256
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110256
18 years, 4 months