-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: How to access secured (Weblogic) datasource using Hibernate?
PostPosted: Wed Aug 11, 2004 12:08 pm 
Newbie

Joined: Thu Aug 05, 2004 5:26 am
Posts: 2
Hibernate version: 2.1.4

Mapping documents: N/A

Code between sessionFactory.openSession() and session.close(): N/A

Full stack trace of any exception that occurs: N/A

Name and version of the database you are using: Oracle 9i

Debug level Hibernate log excerpt: N/A

Hi everyone,

I want to use a secure datasource with Hibernate on Weblogic 8.1. Our application does not actually use Java authentication. Hence we have up until now defined a role 'app_role' on the WL server, applied a policy to the datasource of type 'User must be of role app_role' and then used the run-as element in the ejb-jar.xml to set the identity each EJB runs at:

{excerpt from ejb-jar.xml}
<session>
<ejb-name>...</ejb-name>
<local-home>...</local-home>
<local>...</local>
<ejb-class>...</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<security-identity>
<run-as><role-name>app_role</role-name></run-as>
</security-identity>
</session>

Is there any way to emulate this setup using Hibernate so we can access the datasource as a user of type 'app_role' in the absence of Java authentication? Clearly doing nothing means running as user 'anonymous' and being denied access to the source.
Congrats on Hibernate btw..everything I have done with it up until now has seemed to work the natural way this sort of thing should work!

Many thanks,

Marc


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 3:00 pm 
Beginner
Beginner

Joined: Mon Aug 09, 2004 12:31 pm
Posts: 47
Location: New York, NY, USA
You can get the datasource yourself via JNDI, then give a Connection to the Session when you open it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 3:09 pm 
Beginner
Beginner

Joined: Mon Aug 09, 2004 12:31 pm
Posts: 47
Location: New York, NY, USA
Actually, even better. Implement (or extend) DatasourceConnectionProvider, and specify it in hibernate.properties via hibernate.connection.provider_class

See the javadocs for ConnectionProviderFactory, ConnectionProvider and DatasourceConnectionProvider.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 12, 2004 5:52 am 
Newbie

Joined: Thu Aug 05, 2004 5:26 am
Posts: 2
That is good advice, thanks very much.

Marc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.