Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elide security layer implementation #750

Closed
The-Zombie-Horde opened this issue Feb 21, 2019 · 6 comments
Closed

Elide security layer implementation #750

The-Zombie-Horde opened this issue Feb 21, 2019 · 6 comments

Comments

@The-Zombie-Horde
Copy link

I am using elide to expose the entity something like /book/{id}. We have 2 way ssl implemented. How to integrate elide security layer so that elide security permissions tags can be used. We have 2 way ssl handshake using x.509 certificate.

@aklish
Copy link
Member

aklish commented Feb 22, 2019

Assuming you are using the JAX-RS servlet to expose Elide, you would write a JAX-RS ContainerRequestFilter which extracts the CN from your X509 cert and maps that to a SecurityContext.

You do that in a method like:

    public void filter(ContainerRequestContext containerRequestContext) throws IOException {
         SecurityContext originalSecurityContext = containerRequestContext.getSecurityContext();
         containerRequestContext.setSecurityContext(new SecurityContext() {

         ...

Make sure you are using the latest version of Elide (which passes the User object as the SecurityContext by default). Otherwise there is an extra step.

@The-Zombie-Horde
Copy link
Author

The-Zombie-Horde commented Feb 22, 2019

I was looking at your documentation of elide framework and they are old and hence wanted to confirm with you.

Once user is extracted from above step, do we have to use com.yahoo.elide.resources.JsonApiEndpoint to pass user to Entity layer in order to use security permission tags?

@aklish
Copy link
Member

aklish commented Feb 25, 2019

You don't have to use the provided JAX-RS endpoints - but you would need to create something equivalent to them.

I've hopefully addressed the documentation issue here:

yahoo/elide-doc#77

@The-Zombie-Horde
Copy link
Author

The-Zombie-Horde commented Feb 26, 2019

Thanks a million! Let me take a look and get back to you if any issue.
@Autowired
EntityManagerFactory emf;

Does Elide support Jpa or it requires emf.unwrap(SessionFactory.class); ?

@aklish
Copy link
Member

aklish commented Feb 28, 2019

I'm not totally following the question although there is another pull request for a proper Jpa DataStore that's in review:

#747

@aklish
Copy link
Member

aklish commented Mar 3, 2019

Closing this issue since the documentation has been merged.

@aklish aklish closed this as completed Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants