diff options
author | Keith Wall <kwall@apache.org> | 2014-09-25 14:40:31 +0000 |
---|---|---|
committer | Keith Wall <kwall@apache.org> | 2014-09-25 14:40:31 +0000 |
commit | 0336eaa7a0a6c414ff292e96871f3dc6d5a95204 (patch) | |
tree | 4e917fb21a33482d19da20331dee0ff22b574554 /python/qpid/saslmech/amqplain.py | |
parent | 6c4b6c2d0f7739996fa5120c897ec1de800f7107 (diff) | |
download | qpid-python-0336eaa7a0a6c414ff292e96871f3dc6d5a95204.tar.gz |
QPID-6116: [Python Client 08..091] Add ability to negotiate SASL mechanism and add pure python implementations for SCRAM/CRAM/PLAIN mechanisms
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1627554 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/saslmech/amqplain.py')
-rw-r--r-- | python/qpid/saslmech/amqplain.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/python/qpid/saslmech/amqplain.py b/python/qpid/saslmech/amqplain.py new file mode 100644 index 0000000000..d31997eefd --- /dev/null +++ b/python/qpid/saslmech/amqplain.py @@ -0,0 +1,31 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from sasl import Sasl, SaslException + +class AMQPLAIN(Sasl): + + def initialResponse(self): + if (self.user is None or self.password is None): + raise SaslException("User and password must be specified") + + return {"LOGIN": self.user, "PASSWORD": self.password} + + def priority(self): + return 0
\ No newline at end of file |