initial commit
This commit is contained in:
commit
beb0a7adfd
4 changed files with 54 additions and 0 deletions
24
LICENSE
Normal file
24
LICENSE
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Copyright (C) 2022 Marius Schellenberger
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* The names of the authors and/or contributors may not be used to
|
||||
endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ston1th BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
13
README.md
Normal file
13
README.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# GoAcc Auth Plugin for Radicale
|
||||
|
||||
GoAcc: https://git.giftfish.de/ston1th/goacc
|
||||
|
||||
Radicale: https://radicale.org/master.html#authentication-plugins
|
||||
|
||||
Config:
|
||||
|
||||
```
|
||||
[auth]
|
||||
type = radicale_goacc_auth
|
||||
goacc_url = https://accounts.example.com
|
||||
```
|
||||
16
__init__.py
Normal file
16
__init__.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import requests
|
||||
from radicale.auth import BaseAuth
|
||||
|
||||
PLUGIN_CONFIG_SCHEMA = {"auth": {
|
||||
"goacc_url": {"value": "", "type": str}}}
|
||||
|
||||
class Auth(BaseAuth):
|
||||
def __init__(self, configuration):
|
||||
super().__init__(configuration.copy(PLUGIN_CONFIG_SCHEMA))
|
||||
|
||||
def login(self, login, password):
|
||||
url = self.configuration.get("auth", "goacc_url")
|
||||
r = requests.get(url+"/auth/basic", auth=(login, password))
|
||||
if r.text == "ok\n":
|
||||
return login
|
||||
return ""
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
requests>=2.28.1
|
||||
Loading…
Add table
Add a link
Reference in a new issue