scitokens / scitokens-cpp

A C++ implementation of the SciTokens library with a C library interface
Apache License 2.0
5 stars 22 forks source link

No logging information on token verification process #28

Open andreaceccanti opened 4 years ago

andreaceccanti commented 4 years ago

The scitokens-cpp library provides no logging about the reasons behind a token verification failure. This makes debugging authorization problems complex.

bbockelm commented 4 years ago

@djw8605 - can you take a look at this?

I believe, for the Python library, we hooked into the underlying standard Python logging system. Perhaps we can ask users to provide a callback that they implement (and ship a default to log to stdout)?

djw8605 commented 4 years ago

The functions themselves provide error text as a returned string. For example:

https://github.com/scitokens/scitokens-cpp/blob/6e293ad5ec008e5bdc632d735c8b1b12c8e5a7de/src/scitokens.h#L87

The error is returned in the error_msg variable. You are correct, the library doesn't log anything to stdout, but it does provide error messages back to the calling code.

We could ship the log to stdout? Or, we can rely on the calling code to log the errors, as we do in xrootd-scitokens:

https://github.com/scitokens/xrootd-scitokens/blob/124062e496def27bd7d47be2ff8853458236f2c8/src/scitokens.cpp#L353-L360