Пример #1
0
 def __init__(self):
     config = read_config_file()
     self.LDAP_HOST = config.get('ldap', 'host')
     self.LDAP_PORT = int(config.get('ldap', 'port'))
     self.LDAP_PROTO = 'ldaps' if config.getboolean('ldap', 'ssl') else 'ldap'
     self.LDAP_BIND_METHOD = config.get('ldap', 'bind_method')
     self.LDAP_BASE = config.get('ldap', 'base')
     self.LDAP_BIND_DN = config.get('ldap', 'bind_dn')
     self.LDAP_PASS = config.get('ldap', 'password')
     self.ID_MAPPING = config.get('ldap', 'id_mapping')
     self.DISPLAY_MAPPING = config.get('ldap', 'display_mapping')
     self.OBJECT_CLASS = config.get('ldap', 'object_class')
     self.REQUIRED_GROUP = config.get('ldap', 'required_group')
Пример #2
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function

import time

from flask import Blueprint, request, session, redirect, url_for, render_template, flash

from lwp.utils import get_token, read_config_file

import lwp.authenticators as auth

AUTH = read_config_file().get('global', 'auth')
AUTH_INSTANCE = auth.get_authenticator(AUTH)
print(' * Auth type: ' + AUTH)


# Flask module
mod = Blueprint('auth', __name__)


@mod.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        request_username = request.form['username']
        request_passwd = request.form['password']

        current_url = request.form['url']

        user = AUTH_INSTANCE.authenticate(request_username, request_passwd)

        if user:
Пример #3
0
 def __init__(self):
     self.HTPASSWD_FILE = read_config_file().get('htpasswd', 'file')
Пример #4
0
 def __init__(self):
     self.HTPASSWD_FILE = read_config_file().get('htpasswd', 'file')
Пример #5
0
 def __init__(self):
     self.HTTP_USER = read_config_file().get('http', 'username')
     self.HTTP_PASSWORD = read_config_file().get('http', 'password')
     self.HTTP_AUTH_URL = read_config_file().get('http', 'auth_url')
     self.HTTP_SSL_VERIFY = read_config_file().get('http', 'ssl_verify')
Пример #6
0
 def __init__(self):
     self.HTTP_USER = read_config_file().get('http', 'username')
     self.HTTP_PASSWORD = read_config_file().get('http', 'password')
     self.HTTP_AUTH_URL = read_config_file().get('http', 'auth_url')
     self.HTTP_SSL_VERIFY = read_config_file().get('http', 'ssl_verify')
Пример #7
0
import re
import time
import socket
import subprocess
import ConfigParser

from flask import Blueprint, request, session, g, redirect, url_for, abort, render_template, flash, jsonify

import lwp
import lwp.lxclite as lxc
from lwp.utils import query_db, if_logged_in, get_bucket_token, hash_passwd, read_config_file, cgroup_ext
from lwp.views.auth import AUTH

# TODO: see if we can move this block somewhere better
try:
    config = read_config_file()
    USE_BUCKET = config.getboolean('global', 'buckets')
    BUCKET_HOST = config.get('buckets', 'buckets_host')
    BUCKET_PORT = config.get('buckets', 'buckets_port')
except ConfigParser.NoOptionError:
    USE_BUCKET = False
    print("- Bucket feature disabled")

storage_repos = config.items('storage_repository')

# Flask module
mod = Blueprint('main', __name__)


@mod.route('/')
@mod.route('/home')
Пример #8
0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function

import time

from flask import Blueprint, request, session, redirect, url_for, render_template, flash

from lwp.utils import get_token, read_config_file

import lwp.authenticators as auth

AUTH = read_config_file().get('global', 'auth')
AUTH_INSTANCE = auth.get_authenticator(AUTH)
print(' * Auth type: ' + AUTH)

# Flask module
mod = Blueprint('auth', __name__)


@mod.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        request_username = request.form['username']
        request_passwd = request.form['password']

        current_url = request.form['url']

        user = AUTH_INSTANCE.authenticate(request_username, request_passwd)

        if user:
            session['logged_in'] = True
Пример #9
0
import re
import time
import socket
import subprocess
import ConfigParser

from flask import Blueprint, request, session, g, redirect, url_for, abort, render_template, flash, jsonify

import lwp
import lwp.lxclite as lxc
from lwp.utils import query_db, if_logged_in, get_bucket_token, hash_passwd, read_config_file, cgroup_ext
from lwp.views.auth import AUTH

# TODO: see if we can move this block somewhere better
try:
    config = read_config_file()
    USE_BUCKET = config.getboolean('global', 'buckets')
    BUCKET_HOST = config.get('buckets', 'buckets_host')
    BUCKET_PORT = config.get('buckets', 'buckets_port')
except ConfigParser.NoOptionError:
    USE_BUCKET = False
    print("- Bucket feature disabled")


storage_repos = config.items('storage_repository')

# Flask module
mod = Blueprint('main', __name__)


@mod.route('/')