Comments (12)
I don't understand the use case here. There is already a handle to the object that you can check for this information. Why does it need to be a method specifically (it's already an @property
method)?
from python-gssapi.
What do you mean by handle? What do you suggest to do to check whether given credentials are valid? Maybe I'm just missing something. I didn't say it has to be a method, I said property in this issue. What I need to do is 1. acquire credentials 2. check whether they're valid. Actually, it would be sufficient if the Credentials constructor raised ExpiredCredentialsError when the acquired creds are expired (which doesn't always seem to be the case)
from python-gssapi.
Michael Šimáček [email protected] writes:
What do you mean by handle? What do you suggest to do to check whether
given credentials are valid?
Didn't you just post lines that check if a credential is valid?
Maybe I'm just missing something. I didn't say it has to be a method,
I said property in this issue.
Why does property vs. method make a difference here? Either way it's a
call to the underlying GSSAPI layer.
What I need to do is 1. acquire credentials 2. check whether they're
valid. Actually, it would be sufficient if the Credentials constructor
raised ExpiredCredentialsError when the acquired creds are expired
(which doesn't always seem to be the case)
I'm confused here... are you asking for a helper method that does what
those four lines you posted do?
from python-gssapi.
On Fri, 2015-08-21 at 11:26 -0700, Robbie Harwood wrote:
Michael Šimáček [email protected] writes:
What do you mean by handle? What do you suggest to do to check whether
given credentials are valid?Didn't you just post lines that check if a credential is valid?
Maybe I'm just missing something. I didn't say it has to be a method,
I said property in this issue.Why does property vs. method make a difference here? Either way it's a
call to the underlying GSSAPI layer.What I need to do is 1. acquire credentials 2. check whether they're
valid. Actually, it would be sufficient if the Credentials constructor
raised ExpiredCredentialsError when the acquired creds are expired
(which doesn't always seem to be the case)I'm confused here... are you asking for a helper method that does what
those four lines you posted do?
One line beats 4 :-)
If it is a common thing we should probably provide a property that does
it for users in a high level API.
Simo.
Simo Sorce * Red Hat, Inc * New York
from python-gssapi.
The problem is not that it's four lines. The problem is that the second line is unreadable - it looks like an expression with no effect that relies on implementation detail. It looks confusing to both people and static analyzers, such as pylint. As I mentioned, maybe it would be better to just do the check for expiration in Credentials.init. Or does acquiring expired credentials have any use-case?
from python-gssapi.
You may be acquiring credentials just to know who the principal is and it is not hugely important if credentials are expired or not because you may then go on and use gss_acquire_cred_with_password by using the expired credentials name as the name of the creds you want to acquire with the password.
from python-gssapi.
Perhaps we should not throw exception when inquiring though, and just return lifetime of 0.
We should throw the exception if the user tries to use expired credentials though.
from python-gssapi.
That would be actually even better. It's more flexible and more intuitive for new users of the library - people generally don't expect properties to have visible side-effects. So unless backwards compatibility is an issue, I would prefer this to the helper property/method solution.
from python-gssapi.
As I mentioned, maybe it would be better to just do the check for expiration in
Credentials.__init__
.
According to RFC 2744, this can actually happen (check out http://pythonhosted.org/gssapi/gssapi.html#gssapi.creds.Credentials). Can you confirm that you're successfully acquiring expired credentials, and then checking the lifetime throws an exception?
the problem is that the second line is unreadable - it looks like an expression with no effect that relies on implementation detail
agreed
So unless backwards compatibility is an issue, I would prefer this to the helper property/method solution.
Backwards compatibility is an issue -- if we did something like this, it would have to be part of v2.0.0, and not the v1.y.z series.
from python-gssapi.
Can you confirm that you're successfully acquiring expired credentials, and then checking the lifetime throws an exception?
export KRB5CCNAME=FILE:/tmp/ccache
kinit -l 1
sleep 1 # let it expire
python -c 'import gssapi as g;g.Credentials().lifetime' # this fails with ExpiredCredentialsError
python -c 'import gssapi as g;g.Credentials()' # but this doesn't
from python-gssapi.
hmm... I would not be terribly opposed to adding a Credentials#expired
property However, I'd like to know the context of this request -- is there something preventing you from doing this?
creds = gssapi.Credentials()
try:
use_my_creds(creds)
except gssapi.exceptions.ExpiredCredentialsError:
print('Ah man, your creds are expired!')
Unless it shells out to krb5 or tries to use acquire_cred_with_password
, there's not much recourse for a GSSAPI application if the credentials are expired...
from python-gssapi.
The use case is when python-gssapi is only used to acquire/query the credentials, but they are then used by something else - another library or another application that uses the ccache.
from python-gssapi.
Related Issues (20)
- problem with pip install HOT 1
- GSSAPI won't install on Python 3.11 beta HOT 4
- Installing v1.8.0 from sdist fails with old pip versions HOT 3
- gssapi.raw.add_cred_with_password() is missing on Windows HOT 1
- gssapi.raw.acquire_cred_with_password() fails on Windows HOT 1
- Broken links to documentation in the README HOT 1
- I'm having trouble making this snippet to work HOT 2
- lifetime argument not respected when initiating credentials
- Mypy error with creds type HOT 2
- 1.8.2: issues with testing `gssapi` using pytest HOT 1
- Error building wheel HOT 3
- Cython 3 compatibility HOT 2
- gssapi fails to import: ./Include/cpython/tupleobject.h:23: PyTuple_GET_SIZE: Assertion `PyTuple_Check(op)' failed. HOT 6
- Minor (2529639053): Matching credential not found HOT 5
- KRB5_TRACE is set but not creating logs HOT 4
- segfault on s390x HOT 10
- AWS EC2 Kerberos incorrect real_name for krbtgt HOT 2
- 1.8.3: documentation uses recommonmark which is now deprecated HOT 1
- RFE: provide manylinux binary wheel package HOT 5
- Error building on MacOS drawin nix enviroment HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-gssapi.