dpsu84620 2014-07-06 23:03
浏览 20

保护Angular / Go Google App Engine应用程序

I have a Go app that uses Angular for the frontend. The Go app is the backend, and is used to handle rest requests. Angular will make service requests to Go to get data, save data, etc.

I have the app deployed as a Go app on GAE, so I thought I would use some Google service to secure the app. I do not know how to secure the application. I want to secure the entire app, and have different areas of the app require different user roles. For instance, I want an 'admin' area, a 'view only' area, etc.

I have the app deployed on GAE and it works fine, I now just need to add the security pieces. I am confused if I need to reference how to secure Go or Angular apps on GAE, since it is sort of both; however, my app.yaml uses "api_version: go1"

In case it matters, my file layout is:

fooProject
    |
    src (where app.yaml is)
     |
     frontend (where my angular files are)
     |   |
     |   app 
     |   |
     |   partials
     github.com
         |
         me(where my go files are)
         |
         gorilla (using gorilla for some Go stuff)

A snippet of app.yaml:

application: fooproject
version: 1
runtime: go
api_version: go1

handlers:

  - url: /_ah/remote_api
  script: _go_app
  login: admin

  - url: /rest/.*
  script: _go_app
  login: required
  auth_fail_action: unauthorized

 - url: /
  static_files: frontend/index.html
  upload: frontend/index.html
  login: required
  mime_type: text/html; charset=utf-8

Snippet of app.js:

app.config(function($routeProvider, RestangularProvider) {
    $routeProvider.
        when('/', {
            controller:EntryCtrl,
            templateUrl:'frontend/partials/entry.html'
        }).
        when('/admin/carList', {
            controller:ListCtrl,
            templateUrl:'frontend/partials/admin/car-list.html'
        }).

What confuses me is, is Go or Angular controlling the URLs? Angular has the URL mapping, but Go has app.yaml defining URLs too. I do not know how to think of these two items together while figuring out how to secure the app. Any push in a direction?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
    • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
    • ¥200 uniapp长期运行卡死问题解决
    • ¥15 latex怎么处理论文引理引用参考文献
    • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
    • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?