I have a common login page for different applications which uses jwt token and when I want to call this component's rest API I have to put the jwt to the header to get the user_info. I have multiple application that uses this component and it will be easier if I can use a common Oauth2 server for this purpose.
I started to use ory/hydra and I don't really understand how does it work. I downloaded it and run on on localhost with port 4444 and 4445 (admin) with hydra serve all command. After that in another command line I run the following line:
$ hydra clients create --skip-tls-verify --endpoint 'https://localhost:4445' --id client_id --secret secret -c 'https://localhost:8082/login/oauth2/code/' -a 'user_info'
The login page that I can use looks like : 'https://loginpage.../login.html?redirect_url=' What should be the redirect url in this case? (I will have multiple spring boot app)
hydra.yml:
log:
level: info
format: json
serve:
public:
port: 4444
host: speacial-host
admin:
port: 4445
host: speacial-host
dsn: memory
webfinger:
jwks:
broadcast_keys:
- hydra.jwt.access-token # This key will be exposed when the OAuth2 Access Token strategy is set to JWT.
oidc_discovery:
- user_info
userinfo_url: http://restapi_url:8080/backend/api/user_info
urls:
self:
issuer: https://speacial-host:4444/
public: https://speacial-host:4444/
login: https://loginpage.../login.html?redirect_url=https://127.0.0.1:4444/oauth/callback
oauth2:
expose_internal_errors: true
profiling: cpu
I need the oauth server to handle the jwt token. So when I have to call the REST API I need would like to call for the oauth server for this purpose.
Spring boot app application.yml:
server:
port: 8082
servlet:
session:
cookie:
name: UISESSION
spring:
thymeleaf:
cache: false
security:
oauth2:
client:
registration:
custom-client:
client-id: client_id
client-secret: secret
client-name: Auth Server
scope: user_info
provider: custom-provider
redirect-uri: https://127.0.0.1:4444/oauth/callback
client-authentication-method: basic
authorization-grant-type: authorization_code
provider:
custom-provider:
token-uri: https://localhost:4444/oauth2/token
authorization-uri: https://localhost:4444/oauth2/auth
user-info-uri: https://localhost:4444/userinfo
user-name-attribute: name
Is there any config parameter that I missed?