K
K
ksosha2015-03-25 21:49:03
Java
ksosha, 2015-03-25 21:49:03

How to do OAuth on the server in Java?

How to do authorization/registration with OAuth 2.0. REST API in Java and client in AngularJS. I chose RESTEasy as a jax-rs implementation, but I can't figure out how to register and authorize. I want MongoDB database, can anyone help, suggest.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey Myvrenik, 2016-03-08
@gim0

I realize that the question is almost a year old, but I was also looking for options to create oauth2 authorization for my REST API on RESTEasy. JBoss has such a wonderful product as Keycloak , with which you can organize all sorts of authorizations. It integrates into WildFly, it is enough to configure it and specify the KEYCLOAK authorization type in the web.xml of your J2EE application.

<context-param>
    <param-name>resteasy.role.based.security</param-name>
    <param-value>true</param-value>
  </context-param>
  <login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>my-realm-name</realm-name> <!-- Заменить на свой realm -->
  </login-config>
  <security-role>
    <role-name>admin</role-name>
  </security-role>
  <!-- Тут перечисляем все используемые роли -->

See https://keycloak.github.io/docs/userguide/keycloak...

N
Nikita, 2015-03-26
@jkotkot

There is a non-trivial spring-oauth, but a bunch of all sorts of figs.
If through social networks, that is, spring-social. I don’t know how it all integrates if the spring is not used.

N
Nikolai Pavlov, 2015-03-26
@gurinderu

Open the link http://oauth.net/2/
All popular implementations are described there.
And both client and server.

P
PRVictor, 2017-05-26
@PRVictor

Yes, thanks for the comment. Very interesting - I have not come across KEYCLOAK before. Looks very attractive. I wonder if there are other similar solutions? Here's what I found:
1) WSO2 Identity Server: wso2.com/identity-and-access-management
2) Gluu Server: https://www.gluu.org/
3) Identity Blitz: https://identityblitz.ru/ (as I understand it, domestic development)
Has anyone had experience with such systems?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question