go-oneroster

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2019 License: MIT

README

GoOneRoster

This project aims to implement a OneRoster compliant RESTful API webserver in GO with a MongoDB backing for persistance

Setup

Start up the api server with either envs or flags

flags
goors \
    -k "mySecretKey" \
    -a "HS256" \
    -m "mongodb://myinstance.domain.com:27017" \
    -p "443"
envs
GOORS_AUTH_KEY='mySecretKey'
GOORS_AUTH_KEY_ALG='HS256'
GOORS_MONGO_URI='mongodb://myinstance.domain.com:27017'
GOORS_PORT='443'
Upload Data

Import data using the (sis sync tool)[https://github.com/fffnite/go-oneroster-sis-sync] or by making POST requests.

Query examples

# login
curl "myserver.domain.com/ims/oneroster/v1p1/login" \
    -X POST \
    -d "clientid=$ci&clientsecret=$cs"

# Upsert user id 1
curl "myserver.domain.com/ims/oneroster/v1p1/users/1" \
    -X PUT \
    -H "Authorization: Bearer $t"
    -d '{"sourcedId": "1", "status": "active", "givenName": "bob"}'

# Get all users
curl "myserver.domain.com/ims/oneroster/v1p1/users" \
    -H "Authorization: Bearer $t"
# login
$args = @{
    uri = "http://myserver.domain.com/ims/oneroster/v1p1/login"
    method = "POST"
    body = @{ "clientid" = $ci; "clientsecret" = $cs }
}
$token = Invoke-RestMethod @args

# Upsert user id 1
$upsert = @{
    uri = "http://myserver.domain.com/ims/oneroster/v1p1/users/1
    method = "PUT"
    headers = @{ "authorization" = "bearer $t"}
    body = "{""sourcedId"": ""1"", ""status"": ""active"", ""givenName"": ""bob""}"
}
Invoke-RestMethod @upsert

$getUsers = @{
    uri = "http://myserver.domain.com/ims/oneroster/v1p1/users"
    heades = @{ "authorization" = "bearer $t" }
    FollowRelLink = $true
}
Invoke-RestMethod @getUsers

To Do

  • Connect to SQL database
  • Read from Conf.hcl
  • Build DB handler
  • Connect packages
  • Output from DB
  • Output JSON
  • Output correct json from single endpoint sample
  • Implement RESTful parameters & operators
  • Implement logging
  • Implement error handling
  • Implement security
  • Build core endpoints
  • Sync DB
  • Build extra endpoints
  • Test test test

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL