JPA / Hibernate with Oracle Label Security

I have an application built using Spring and JPA / Hibernate that works very well, but now I have a requirement to add Oracle Label Security. This will require the creation of a proxy user assigned with specific roles in addition to the actual user. I do not understand what is included in persistence.xml and what is happening in the code. In addition, if we want to get really fantasy, I would really like to know how Spring can insert the corresponding persistence context with the user mapping into a proxy user.

If anyone has experience with this, any understanding is appreciated.

thanks.

+4
source share
1 answer

I would approach it as follows:

First get the basics of proxy authentication. This article looks promising: https://blogs.oracle.com/olaf/entry/using_oracle_proxy_authenticat

Assuming you have a web application (or something else with one entry point), create a filter that accepts the request, identifies the user, installs the user in the database using proxy authentication, and then redirects the request.

Thus, your application will only see the correct connections with the correct user. Therefore, your Hibernate configuration should not be affected by this.

One warning: you are probably using connection pools. These pools may not pass you the JDBC implementation for Oracle, but a shell through which you need to access specific Oracle functions. Make sure that your application still uses the shell, but the connection pool does not notice any exceptions caused by the connection, thereby not recognizing broken connections and throws them again and again.

0
source

Source: https://habr.com/ru/post/1299442/


All Articles