mitreid-connect / OpenID-Connect-Java-Spring-Server

An OpenID Connect reference implementation in Java on the Spring platform.
Other
1.48k stars 765 forks source link

API Documentation #1309

Open RemitAlert opened 7 years ago

RemitAlert commented 7 years ago

Hi ,

Is there any API documentation available? We are trying to use the server as AS ( Authorization Server) in OAuth2. All our use cases are for grant type client_credential. We need to add the clients dynamically and the client gets the token from token API and passes it in API call to us. I see there is some documentation here ( https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/wiki/API) but it doesn't have details on what parameters are required.

-N

col-panic commented 6 years ago

Same problem here!

Can you access the API using non-browser tools? I always get results like

{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}
col-panic commented 6 years ago

Does this server support features like https://connect2id.com/products/server/docs/api/client-registration - Open Registration / Managed Registration. I am currently trying to solve a dynamic registration for a introspection client without the user needing to intervene.

At the moment I don't seem to find a way to realize such a scenario.

col-panic commented 6 years ago

See https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/issues/1220

jricher commented 6 years ago

You should be able to access the client API using an access token from the server owned by any of the admin users (or really, with "admin" rights to it). We don't have a separate scope for this API access at this time because it needs to be an admin user anyway.

Note that there's also dynamic registration for both clients and protected resources, available without an access token. This is separate from the API.

col-panic commented 6 years ago

Thanks! Does this work without the web-browser being involved?! I can't figure out how to this this e.g. using cUrl (where no JSESSIONID whatsoever is created!)

jricher commented 6 years ago

Yes, you need to get and then pass an OAuth token to the API and then you can call it using that token without a browser. That's if you're using the API. If you're using dynamic registration, you can just call it directly without a token.

col-panic commented 6 years ago

I am still confused on this, lets please fix an example.

GOAL I want to automagically (That is, no web-browser involved - everything just happens by the code) register a protected resource.

PRE-CONDITION

METHOD

MY PROBLEM/QUESTIONS

To me this seems like a chicken and egg problem - is it correct, that in any case there has to be an initial configured client available (even if I have username, password of an admin) in order to perform serious administration tasks?

jricher commented 6 years ago

There's no standard way to do it but this project has a feature that does exactly what you want: You can use the protected resource registration endpoint for this.

https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/blob/master/openid-connect-server/src/main/java/org/mitre/openid/connect/web/ProtectedResourceRegistrationEndpoint.java

No tokens or logins needed, since it's not part of the site API. See the user-interactive page that calls this at https://mitreid.org/manage/dev/resource

antonionehme commented 6 years ago

I think I have the same question: is there any documentation/examples on how to use the authorization server endpoints. Probably similar to that can be found here: https://backstage.forgerock.com/docs/am/5.5/uma-guide/#chap-uma-implementation

yoursuche commented 3 years ago

You should be able to access the client API using an access token from the server owned by any of the admin users (or really, with "admin" rights to it). We don't have a separate scope for this API access at this time because it needs to be an admin user anyway.

Note that there's also dynamic registration for both clients and protected resources, available without an access token. This is separate from the API.

How do I get an access token from the server owned by an admin users?

jricher commented 3 years ago

The admin user can authorize a client just like any other user of the server, using the standard OAuth protocols.

yoursuche commented 3 years ago

The admin user can authorize a client just like any other user of the server, using the standard OAuth protocols.

Thanks a lot @jricher I was able to get it to work.