GithubHelp home page GithubHelp logo

radudragusin / webdav-kerberos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bobcarroll/webdav-kerberos

0.0 1.0 0.0 128 KB

Kerberised WebDAV client library for Python

License: Other

Python 100.00%

webdav-kerberos's Introduction

WebDAV-Kerberos

WebDAV-Kerberos is a Kerberised subclass of the davlib.DAV class found in the Python_WebDAV_Library package. This module depends on Python_WebDAV_Library and PyKerberos. Python 3 is not (yet) supported. Installing and configuring Kerberos properly is left as an exercise for the reader.

Dependencies

  • Python_WebDAV_Library (tested with version 0.4.2)
  • PyKerberos (tested with revision 11110)

Usage

The interface is exactly the same as davlib.DAV.

Krb5DAV includes an extra constructor argument and an extra function. Specify the principal constructor argument to set the client user principal name you wish to connect as. Omitting this argument will cause the Kerberos client to use the principal of the current user.

The Krb5DAV.whoami() function will return the authenticated user principal name. If called before authentication the function will return the value of the principal constructor argument, which may be the empty string if you omitted the argument.

Examples

from krb5dav import Krb5DAV

# Connect to SharePoint with the credentials of the current user. You must
# have a fresh ticket in your Kerberos credentials cache for this to work.
dav = Krb5DAV('sharepoint.example.com', protocol='http')

response = dav.get('/MySite/Home/Shared%20Documents/foo.docx')
with open('/tmp/foo.docx', 'wb') as outfile:
    outfile.write(response.read())
dav.close()

# Connect to SharePoint with specific credentials. You must have a Kerberos
# keytab file with the principal's key, and the current user must have read
# access to it.
dav = Krb5DAV('sharepoint.example.com', protocol='http', principal='[email protected]')

with open('/tmp/foo.docx', 'rb') as infile:
    buf = infile.read()
dav.put('/MySite/Home/Shared%20Documents/foo2.docx', buf)
dav.close()

webdav-kerberos's People

Contributors

bobcarroll avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.