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

need the jwt.h file #133

Closed
bouharb opened this issue Aug 9, 2019 · 9 comments
Closed

need the jwt.h file #133

bouharb opened this issue Aug 9, 2019 · 9 comments

Comments

@bouharb
Copy link

bouharb commented Aug 9, 2019

@babelouest
I need the same jwt.h file version.

where can I find it ?
Great thanks in advance.

@babelouest
Copy link
Owner

Hello @bouharb ,

To use example_callbacks/oauth2_bearer/glewlwyd_resource.c, you need to install libjwt. I added the precision in the readme file. Thanks!

@bouharb
Copy link
Author

bouharb commented Aug 9, 2019

Hello @babelouest,

libjwt package does not support ubuntu 18.04

Capture du 2019-08-10 00-40-22

@babelouest
Copy link
Owner

That's more a question to ask to the author of the library but I know at least two ways to install libjwt on Ubuntu 18.04 that work.

install from ubuntu repository

$ sudo apt install libjwt-dev

install from source: https://github.com/benmcollins/libjwt#build-instructions

@bouharb
Copy link
Author

bouharb commented Aug 10, 2019

thanks but is missing params in struct config :

  • accept_access_token
  • accept_client_token

Capture du 2019-08-10 05-16-52

babelouest added a commit that referenced this issue Aug 10, 2019
@babelouest
Copy link
Owner

Fixed in d807e89
The source was not up-to-date with the documentation

@bouharb
Copy link
Author

bouharb commented Aug 10, 2019

Hello @babelouest ,

bug in converting to a pointer type

Capture du 2019-08-10 05-36-42

@babelouest
Copy link
Owner

@bouharb , obviously there's a problem in your code, you pass wrong argument types to ulfius_add_endpoint_by_val, the documentation has all the anwers.

You should also explore the example programs to understand the syntax.

And more generally, if you have a problem that doesn't have the answer in the documentation or the examples, do not answer in an issue that is about another subject, open a new issue.

And when you write an issue, post a sample code that can be copy/paste and the output result if relevant, no screenshots.

Thanks in advance

@bouharb
Copy link
Author

bouharb commented Aug 10, 2019

@babelouest , I'm sorry but I took the same code proposed

  • Error : cannot convert to a pointer type in ulfius_add_endpoint_by_val
int main (int argc, char **argv) {

// Initialize the instance
struct _u_instance instance

if (ulfius_init_instance(&instance, PORT, NULL, NULL) != U_OK) {
y_log_message(Y_LOG_LEVEL_ERROR, "Error ulfius_init_instance, abort");
return(1);
}
struct _glewlwyd_resource_config g_config;
g_config.method = G_METHOD_HEADER;
g_config.oauth_scope = "scope1";
g_config.jwt_decode_key = "secret";
g_config.jwt_alg = JWT_ALG_HS512;
g_config.realm = "example";
g_config.accept_access_token = 1;
g_config.accept_client_token = 0;

// Example, add an authentication callback callback_check_glewlwyd_access_token for the endpoint GET "/api/resource/"
ulfius_add_endpoint_by_val(&instance, "GET", NULL, "*",0, &callback_check_glewlwyd_access_token, (void*) g_config);
// Endpoint list declaration
.
.
.

@babelouest
Copy link
Owner

you probably forgot something like

#include "glewlwyd_resource.h"

Can you open a new issue and follow the instructions from the template to help me help you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants