[Security & JAAS/JBoss] - Credential caching question
by c_eric_ray
Hi guys,
I'm have a problem that I'm unable to solve regarding credentials caching. I have an ldap user that can authenticate with ldap but is not authorized to use the application. I want to let the user know that they have authenticated but failed authorization and to trying logging in with another username and password that has authorization. The problem is that the credentials are cached and I cannot get JBoss to serve the login page again.
I'm using form based authentication with the j_security_check action combined with the LdapLoginModule for jboss. Here's what my security-service.xml looks like.
| <!-- JAAS security manager and realm mapping -->
| <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
| name="jboss.security:service=JaasSecurityManager">
| <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
| <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
| <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
| in seconds.
| If you want to disable caching of security credentials, set this to 0 to
| force authentication to occur every time. This has no affect if the
| AuthenticationCacheJndiName has been changed from the default value.
| -->
| <attribute name="DefaultCacheTimeout">0</attribute>
| <!-- DefaultCacheResolution: Specifies the default timed cache policy
| resolution in seconds. This controls the interval at which the cache
| current timestamp is updated and should be less than the DefaultCacheTimeout
| in order for the timeout to be meaningful. This has no affect if the
| AuthenticationCacheJndiName has been changed from the default value.
| -->
| <attribute name="DefaultCacheResolution">0</attribute>
| </mbean>
|
>From my perspective JBoss behaves the same regardless of what I set these values too. Basically, I want to force authentication everytime a certain url is accessed. I don't care if the user has already logged in or not.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958117#3958117
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958117
19 years, 9 months
[EJB 3.0] - @OneToOne, no primary keys...
by tsar_bomba
I'm simply trying to join two entities together w/ a @OneToOne but I'm not using primary keys on either side of the relationship.
Here are my (shortened) entities:
| @Entity
| @Table(name="call_req")
| public class Incident implements Serializable
| {
| @Column(name="status", insertable=false, updatable=false)
| private String status;
|
| @OneToOne(fetch=FetchType.LAZY)
| @JoinColumn(name="status", referencedColumnName="code")
| private IncidentStatus incidentStatus;
| }
|
| @Entity
| @Table(name="cr_stat")
| public class IncidentStatus implements Serializable
| {
| @Column(name="code", nullable=false, insertable=false, updatable=false)
| private String code;
|
| @OneToOne
| private Incident incident;
| }
|
Here's the EJBQL and the query that was generated:
| Hibernate:
| /* select
| i
| from
| Incident i
| inner join
| fetch i.incidentStatus ist */ select
| top 50 incident0_.id as id927_0_,
| incidentst1_.id as id928_1_,
| incident0_.persid as persid927_0_,
| incident0_.ref_num as ref3_927_0_,
| incident0_.summary as summary927_0_,
| incident0_.description as descript5_927_0_,
| incident0_.status as status927_0_,
| incident0_.active_flag as active7_927_0_,
| incident0_.open_date as open8_927_0_,
| incident0_.time_spent_sum as time9_927_0_,
| incident0_.last_mod_dt as last10_927_0_,
| incident0_.close_date as close11_927_0_,
| incident0_.resolve_date as resolve12_927_0_,
| incident0_.rootcause as rootcause927_0_,
| incident0_.log_agent as log14_927_0_,
| incident0_.assignee as assignee927_0_,
| incident0_.group_id as group16_927_0_,
| incident0_.customer as customer927_0_,
| incident0_.charge_back_id as charge18_927_0_,
| incident0_.affected_rc as affected19_927_0_,
| incident0_.support_lev as support20_927_0_,
| incident0_.category as category927_0_,
| incident0_.solution as solution927_0_,
| incident0_.impact as impact927_0_,
| incident0_.priority as priority927_0_,
| incident0_.urgency as urgency927_0_,
| incident0_.severity as severity927_0_,
| incident0_.extern_ref as extern27_927_0_,
| incident0_.last_act_id as last28_927_0_,
| incident0_.cr_tticket as cr29_927_0_,
| incident0_.parent as parent927_0_,
| incident0_.template_name as template31_927_0_,
| incident0_.sla_violation as sla32_927_0_,
| incident0_.predicted_sla_viol as predicted33_927_0_,
| incident0_.created_via as created34_927_0_,
| incident0_.call_back_date as call35_927_0_,
| incident0_.call_back_flag as call36_927_0_,
| incident0_.event_token as event37_927_0_,
| incident0_.type as type927_0_,
| incident0_.change as change927_0_,
| incident0_.problem as problem927_0_,
| incident0_.incident_priority as incident41_927_0_,
| incidentst1_.persid as persid928_1_,
| incidentst1_.del as del928_1_,
| incidentst1_.sym as sym928_1_,
| incidentst1_.last_mod_dt as last5_928_1_,
| incidentst1_.description as descript6_928_1_,
| incidentst1_.code as code928_1_,
| incidentst1_.active as active928_1_,
| incidentst1_.hold as hold928_1_,
| incidentst1_.resolved as resolved928_1_,
| incidentst1_.cr_flag as cr11_928_1_,
| incidentst1_.in_flag as in12_928_1_,
| incidentst1_.pr_flag as pr13_928_1_,
| incidentst1_.incident_id as incident14_928_1_
| from
| call_req incident0_
| inner join
| cr_stat incidentst1_
| on incident0_.status=incidentst1_.code
|
...it's so *close* - if it wasn't creating that 'incident_id' field out of thin-air (which doesn't actually exist in the table) it would be perfect. Otherwise, the join is perfect - exactly what I needed. Of course the exception I get is:
anonymous wrote :
| javax.ejb.EJBException
|
| .............
|
| Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
| at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:567)
| at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:56)
|
| .............
|
| Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
|
| .............
|
| Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid column name 'incident_id'.
| at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
| ..............
|
I need Incident.status = IncidentStatus.code
I'm getting very close but I can't seem to get the right relationship. How can I simply join two entities, one-to-one, where I'm not using the primary keys in either of the two tables as part of the relationship?
Thanks very much in advance!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958116#3958116
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958116
19 years, 9 months