Python - Intranet Web Service - python

About to embark on a Java project using Spring Security to create a Restful Web Service (JSON) that will use Kerberos authentication to authenticate users in Active Directory.
I'm not locked into using Java and am considering the use of Python to gain new skills and look at potential alternative platforms.
So far I have looked at Twisted and Web2Py but they don't seem to have support for Kerberos nor could I find information around implementing Kerberos support.
Does anyone know of frameworks supporting the above deployment or pointers to get me started?

Python Eve is a restful api written in Python that uses mongo as its backend.
It provides a simple class that you can use to implement your own authentication which would allow you to use the python kerberos module
I use this setup but with ldap instead of kerb.
The underlying web framwork behind eve is Flask.

Related

Keycloak UserStorageProvider Python Implementation

As per Keycloak documentation to connect to an existing external database with user information we will need to implement the UserStorageProvider interface:
https://www.keycloak.org/docs/latest/server_development/index.html#_user-storage-spi
I couldn't find the same within the latest version of python keycloak package:
https://pypi.org/project/python-keycloak/
How can i connect to an external database like postgres from my python application if the UserStorageProvider class is not present in the supported keycloak library for python?.
Couldn't find this information on any other forum so any help regarding this would be much appreciated
How can i connect to an external database like postgres from my python
application if the UserStorageProvider class is not present in the
supported keycloak library for python?.
This library:
https://pypi.org/project/python-keycloak/
is just a library for the client side to communicate with the Keycloak server via Rest API calls. From that project you can read
python-keycloak is a Python package providing access to the Keycloak
API.
It is not officially maintained by the Keycloak project; but even if that was the case, it is just a wrap around the Keycloak Rest API. You would not be able to implement your custom UserStorageProvider using it anyway.
When the Keycloak documentation states:
You can use the User Storage SPI to write extensions to Keycloak to
connect to external user databases and credential stores.
is referring to extending the code of the Keycloak server, which is writing in Java not in python. You have to look at this documentation to understand the interfaces provided. To extend the Keycloak server code via Service Provider Interfaces (SPI) check the official documentation. It will tell you how to create your custom user storage provider using SPI.

How to communicate from a Python client to Ruby on Rails application?

I am to develop an app, and I have to choose between Ruby on Rails or Python+Django. So far I want to do it with Ruby on Rails, because i feel more comfortable doing what I have to do on it.
But there is a problem. There would be a client app written on Python that has to communicate with mine. Cause that app should be able to communicate with mine.
First: I think if it is a matter of communicating with the MySQL database there wouldn't be an issue, cause the Python app is able to query to MySQL server with proper authentication right?
Second: and more important question: If I have a Ruby written API, to ease the queries, Could the Python app be able to invoke functions in that API and get the results? If it is possible, How could I achieve that?
Ruby on Rails 5 supports API only app, if you are using this app for APIs only, else just create a normal app and expose API endpoints that render json outputs. Use Active Record for mapping your MySql database and jbuilder for json views (both of which are available by default when you create new app). You will find lots of tutorials if you google Use Ruby on Rails as API app.
Good luck with it.. :)

Using openshift Rest Api in Django framework Python application

i want to strarted to build an application using framework Django in python to consume Openshift rest api that the user will be able to authentication and use their resources.
the objectif of this project is to provide a web-based platform to enable Openshift users to create or interact with their online resources using Openshift web api Rest 3.0 .
Specifications of project : The required service should enable existing projects and new projects management for any user having an Openshift online account. Management includes: -Authentication and Authorization -Teams , members and subscription plan management -SSH keys management -Gear, cartridge and application management -Deployment All these capabilities must be implemented using the Openshift API and provided using a Django based web interface.
i try to read the officiel documentation through URL:https://access.redhat.com/documentation/en-US/OpenShift_Online/2.0/html/REST_API_Guide/index.html
but i can't find a way to start building the application and consuming this rest api. have any one an idea to start
If you are writing a new application, I suggest using v3. The web console already has most of this functionality. The REST API reference should help you get started.

Quickbooks Desktop how to integrate with Python

I am trying to communicate with the QuickBooks Desktop Application using the Quick Books Web Connector (must be done in Python). I am not very familiar with SOAP- I was wondering whether anyone had a template/guide for communicating with the QBWC. I have read QuickBooks Web Connector Program Guide but there was no sample Python code.
The only requirement for which language to use with the Web Connector is to have a functioning SOAP server. From the Programmer's Guide:
What Platforms and Languages can I use in my Implementation?
The web service should be able to run on any platform that supports standard SOAP for communication. Platforms that are known to work include Apache Tomcat (Axis)and ASP (.Net).
As long as you can roll a WSDL-first SOAP server in Python, you can interface with the Web Connector. Unfortunately, it appears that might be a significant hurdle. Check out this question for suggestions on possible ways to accomplish that.
Once you get that working, the QuickBooks SDK provides bare-bones examples of a functioning web service. That should provide a sufficient template/guide for you to successfully interface with QuickBooks through the Web Connector.

Can you run ssl with bottle + AD Authenticate?

I have been looking at multiple sources and can't seem to get a good answer. I am trying to deploy a very simple app that displays information from a mongodb, accepts post data for input, uses SSL, and AD for Authentication.
I am using bottle with python 2.7, mongodb, on a windows 64-bit platform. I can switch to CentOS if that is completely necessary.
So far, none of the very few tutorials out there seem to work on my current configuration. Is what I'm asking for possible? Should I switch to a different framework?
tldr:
Can you run a bottle application with SSL and AD integration?
If not, what python framework would be nearly as easy and still have this functionality.
edit: I found this for flask. Could it work with bottle? Also, can it be done on windows?
There are definitely ways to accomplish your goal of having bottle use SSL + AD on windows.
SSL with bottle:
https://github.com/nickbabcock/bottle-ssl
http://dgtool.blogspot.com/2011/12/ssl-encryption-in-python-bottle.html
bottle on cherrypy server + ssl
python with AD (as well as information on windows specifically):
Authenticating against active directory using python + ldap
https://gist.github.com/ibeex/1288159
If you wanted to use session management for authentication you could pair the AD with bottle middleware such as beaker: bottle hooks with beaker session middleware and checking logins
Bottle itself does not have built in abilities to deal with SSL that I know of like flask. But the last SSL link above shows similar simple useability.

Categories