Code Monkey home page Code Monkey logo

casbin-forum's Introduction

Casbin-forum

Casbin-forum is the official forum for Casbin developers and users.

Link

https://forum.casbin.org/

Architecture

Casbin-forum contains 2 parts:

Name Description Language Source code
Frontend Web frontend UI for Casbin-forum Javascript + React https://github.com/casbin/casbin-forum/tree/master/web
Backend RESTful API backend for Casbin-forum Golang + Beego + MySQL https://github.com/casbin/casbin-forum

Installation

  • Get the code:
go get github.com/casbin/casbin-forum
  • Setup database:

Casbin-forum will store its users, nodes and topics informations in a MySQL database named: casbin_forum, will create it if not existed. The DB connection string can be specified at: https://github.com/casbin/casbin-forum/blob/master/conf/app.conf

dataSourceName = root:123@tcp(localhost:3306)/

Casbin-forum uses XORM to connect to DB, so all DBs supported by XORM can also be used.

  • Setup your forum to enable some third-party login platform:

Casbin-forum provide a way to sign up using Google account, Github account, WeChat account and so on, so you may have to get your own ClientID and ClientSecret first.

  1. Google

    You could get them by clicking on this url: https://console.developers.google.com/apis You should set Authorized JavaScript origins to fit your own domain address, for local testing, sethttp://localhost:3000. And set the Authorized redirect URIs, the same domain address as before, add /callback/google/signup and /callback/google/link after that, for local testing, sethttp://localhost:3000/callback/google/signup + http://localhost:3000/callback/google/link.

  2. Github

    You could get them by clicking on this url: https://github.com/settings/developers You should set Homepage URL to fit your own domain address, for local testing, sethttp://localhost:3000. And set the Authorization callback URL, the same domain address as before, add /callback/github after that, for local testing, sethttp://localhost:3000/callback/github.

And to improve security, you could set a state value determined by yourself to make sure the request is requesting by yourself, such as "random". Those information strings can be specified at: https://github.com/casbin/casbin-forum/blob/master/conf/app.conf

GoogleAuthClientID = "xxx" //your own client id
GoogleAuthClientSecret = "xxx" //your own client secret
GoogleAuthState = "xxx" //set by yourself
GithubAuthClientID = "xxx" //your own client id
GithubAuthClientSecret = "xxx" //your own client secret
GithubAuthState = "xx" //set by yourself

You may also have to fill in the same informations at: https://github.com/casbin/casbin-forum/blob/master/web/src/Conf.js. By the way, you could change the value of scope to get different user information form them if you need, we just take profile and email.

export const GoogleClientId  = "xxx"

export const GoogleAuthState  = "xxx"

export const GoogleAuthScope  = "profile+email"

export const GithubClientId  = "xxx"

export const GithubAuthState  = "xxx"

export const GithubAuthScope  = "user:email+read:user"
  • Fill in your Ali OSS configuration information

    We use Ali OSS to save the user's pictures.

    Informations in Conf.js

    export const OSSRegion = "" //your oss region
    
    //The endpoint of your oss region, find it on https://help.aliyun.com/document_detail/31837.html
    export const OSSEndPoint = "" //your oss end point
    
    export const OSSBucket = "" //your oss bucket
    
    //The path stored in your oss
    //eg: `casbin-forum` or `casbin/forum/xxx/xxx`
    export const OSSBasicPath = "" //prefix for saved pictures 

    Informations in app.conf. You could get your roleArn in https://ram.console.aliyun.com/roles. Before that, you should have a independent account for this application, and add AliyunOSSFullAccess. By the way, you should set your bucket permissions to public read.

    accessKeyID     = ""
    accessKeySecret = ""
    roleArn         = ""
  • Run backend (in port 7000):

go run main.go
  • Run frontend (in the same machine's port 3000):
cd web
npm install
npm run start
  • Open browser:

http://localhost:3000/

casbin-forum's People

Contributors

hsluoyz avatar kocoler avatar

Watchers

James Cloos 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.