Browse Source

Added README file

Arpit Singh 5 years ago
parent
commit
35bb25e886
3 changed files with 57 additions and 0 deletions
  1. 36 0
      README.md
  2. 19 0
      SampleApp/settings.py
  3. 2 0
      SampleApp/urls.py

+ 36 - 0
README.md

@@ -0,0 +1,36 @@
+# Sample App Project
+This is a Django Sample app for client of OpenId server.
+
+## Setup & Running
+
+- [Manually](#manually)
+
+### Manually
+
+Setup project environment with [virtualenv](https://virtualenv.pypa.io) and [pip](https://pip.pypa.io).
+
+```bash
+$ virtualenv -p /usr/bin/python3 project_env
+
+$ source project_env/bin/activate
+
+$ git clone https://gogs.earthsquad.global/evolverarpit/Dajngo_sample_app.git
+$ cd Dajngo_sample_app
+$ pip install -r requirements.txt
+```
+
+Start Application.
+
+```bash
+$ python manage.py migrate
+$ python manage.py createsuperuser
+$ python manage.py runserver 8005
+```
+
+Open your browser and go to `http://localhost:8005`. Voilà!
+
+### Configre Client Application 
+- In setting add following values.
+-- OpenID_SERVER
+-- OpenID_CLIENT_ID
+-- OpenID_CLIENT_SECRET  

+ 19 - 0
SampleApp/settings.py

@@ -37,6 +37,7 @@ INSTALLED_APPS = [
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+    'testOpenId',
 ]
 
 MIDDLEWARE = [
@@ -118,3 +119,21 @@ USE_TZ = True
 # https://docs.djangoproject.com/en/2.0/howto/static-files/
 
 STATIC_URL = '/static/'
+
+# Provider
+OpenID_SERVER            = 'localhost:8000'
+
+# General urls on your provider:
+OpenID_AUTHORIZATION_URL = '/o/authorize'   # Authorization URL
+OpenID_TOKEN_URL         = '/o/token/'      # Access token URL
+
+# The URL of some protected resource on your oauth2 server which you have configured to serve
+# json-encoded user information (containing at least an email) for the user associated
+# with a given access token.
+OpenID_RESOURCE_URL = '/userinfo'
+
+# From the configuration of your client site in the oauth2 provider
+OpenID_CLIENT_ID         = 'SQm9g9AT7Rn4TKvnYlBZSszUQFnQOseq3O4XKxW6'
+OpenID_CLIENT_SECRET     = 'MvJ8u5xD9j0KVTQKCyDxf4La6nJeOmIlXQKYhygWGjZAcv8drK2TjgrtRvaMD9BPRiONnbMYZIG3Eih7ujeTZc88IH6VkvSpmP8nXA4aTi61h8ufOh6mWsq9xjlrwi21'
+
+OpenID_CALLBACK_URL      = 'localhost:8005/callback'

+ 2 - 0
SampleApp/urls.py

@@ -15,7 +15,9 @@ Including another URLconf
 """
 from django.contrib import admin
 from django.urls import path
+from testOpenId import views as testOpenId_views
 
 urlpatterns = [
     path('admin/', admin.site.urls),
+    path('home', testOpenId_views.home, name='home'),
 ]