[JBoss Portal] - JAAS using LDAP and DB
by brownfielda
Howdy,
I'm trying to configure my portal with both LDAP and DB. Ideally I want the default users and roles (admin and user) to live in the database bundled with portal. I also need to authenticate users with an existing LDAP without trying to write anything to the LDAP.
I've been reading through the JBP reference guide, particularly Chapters 15 and 16, but can't seem to wrap my head around how it all fits together. I've found some good threads on this forum, but once again, no amount of reading seems to help me figure out what's going on.
So, I have two quick questions.
1) Will it be possible to assign roles in the DB (namely User) to users authenticated with the LDAP, without modifying the LDAP? I think that synchronize module will help with this but I'm confused by the options.
2) Can anybody point me towards some good introductory JAAS docs? I can't seem to find anything that explains it concisely and accurately. I'm thinking that my problems with configuration come from not understanding JAAS well enough.
Thanks for any help.
--Andrew
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070098#4070098
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070098
18Â years, 8Â months
[JBoss Portal] - Problem while retrieving user details from db
by PVApparao
Hi I am using the following code to retrive the userdetails from db to display the edit profile page
if (user == null) {
throw new PortletException("Not user object found");
} else {
String userid = user.getId().toString();
logger.info("*************** after getting userId ");
logger.info("UserId is ------------------>" + userid);
if (userid != null) {
try {
logger.info("User Id is not null **********");
user = userModule.findUserById(userid);
} catch (Exception e) {
logger.error("Cannot retrive user", e);
}
}
At the above statement it is generating the following exception
17:15:59,140 INFO [UserProfilePortlet] *************** after getting userId
17:15:59,140 INFO [UserProfilePortlet] UserId is ------------------>3
17:15:59,140 INFO [UserProfilePortlet] User Id is not null **********
17:15:59,156 ERROR [HibernateUserModuleImpl] Cannot find user by id 3
org.hibernate.HibernateException: Unable to locate current JTA transaction
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
at org.jboss.portal.identity.db.HibernateUserModuleImpl.getCurrentSession(HibernateUserModuleImpl.java:299)
at org.jboss.portal.identity.db.HibernateUserModuleImpl.findUserById(HibernateUserModuleImpl.java:137)
at org.jboss.portal.identity.db.HibernateUserModuleImpl.findUserById(HibernateUserModuleImpl.java:123)
I have seen a post telling to set
<trans-attribute> Required </trans-attribute> in jboss-portlet.xml.
I did that and tried, still i am getting the same exception.
Any one has idea about this exception
I am using jboss-portal2.6.1 and jboss-4.0.5 as my appserver.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070096#4070096
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070096
18Â years, 8Â months
[JBoss Seam] - inserting value in primary and secondry table using onetoone
by kaviarasu
hi im using two tables Table1 and Table2
Table1 fields
no-primary coloumn
Table2 fields
no-foreign key to table1
eno-primary key of this table
i want tto generate the value automatically in table1 so it want to update the same value in Table2 no and eno without using trigger . The value want to generate and insert after the submit button pressed in JSF page
|
| import java.io.Serializable;
| import java.math.BigDecimal;
| import java.util.Set;
|
| import javax.persistence.CascadeType;
| import javax.persistence.Entity;
| import javax.persistence.GeneratedValue;
| import javax.persistence.Id;
| import javax.persistence.OneToMany;
| import javax.persistence.OneToOne;
| import javax.persistence.PrimaryKeyJoinColumn;
|
| import org.jboss.seam.annotations.Name;
|
| @Entity
|
| public class Table1 implements Serializable {
| private static final long serialVersionUID = 1L;
| @Id
| private BigDecimal no;
| private Table2 eno;
| public Table1() {
| super();
| }
|
| @GeneratedValue
| public BigDecimal getNo() {
| return this.no;
| }
| public void setNo(BigDecimal no) {
| this.no = no;
| }
| @OneToOne(cascade = CascadeType.ALL)
| @PrimaryKeyJoinColumn
| public Table2 getEno() {
| return eno;
| }
| public void setEno(Table2 eno) {
| this.eno = eno;
| }
| }
|
import java.io.Serializable;
| import java.math.BigDecimal;
| import javax.persistence.Entity;
| import javax.persistence.Id;
| import javax.persistence.JoinColumn;
| import javax.persistence.ManyToOne;
| import javax.persistence.OneToOne;
|
| @Entity
| public class Table2 implements Serializable {
| @Id
| private BigDecimal eno;
|
|
| private BigDecimal no;
|
| private static final long serialVersionUID = 1L;
|
| public Table2() {
| super();
| }
|
| public BigDecimal getNo() {
| return this.no;
| }
|
| public void setNo( BigDecimal no) {
| this.no = no;
| }
|
| public BigDecimal getEno() {
| return this.eno;
| }
|
| public void setEno(BigDecimal eno) {
| this.eno = eno;
| }
|
| }
import java.util.List;
|
| import javax.ejb.Stateless;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| import kavi.Table1;
|
| import model.TblUserReviews;
| import model.Write;
|
| import org.hibernate.validator.Valid;
| import org.jboss.seam.annotations.IfInvalid;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Outcome;
|
| @Stateless
| @Name("register")
| public class RegisterAction implements Register {
|
| @In
| @Valid
| private Table1 user1;
|
| @PersistenceContext
| private EntityManager em;
|
| @IfInvalid(outcome = Outcome.REDISPLAY)
| public String register() {
|
| em.persist(user1);
| return "success";
| }
| }
<table border="0" style=" width : 771px;">
| <tr>
| <td>Rate the product</td>
| <td><rich:inputNumberSlider value="#{kavi.no}"/>
| </td>
| <td>
| </td>
| </tr>
| <tr style=" height : 6px;">
| <td>Review Title</td>
| <td><h:inputTextarea value="#{kavi.eno}" style=" width : 445px; height : 34px;"></h:inputTextarea>
| </td>
| </tr>
|
| </table>
| <font color="red"><h:messages /></font>
| <h:commandButton styleClass="formButton" type="submit" value="Register"
| action="#{register.register}" />
Thank ypu
Regards
kavi
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4070087#4070087
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4070087
18Â years, 8Â months