This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | local ffi = require("ffi") | |
| local authlib = ffi.load("/gateway/auth/main/libauth.so") | |
| ffi.cdef([[ | |
| typedef long long GoInt64; | |
| typedef unsigned long long GoUint64; | |
| typedef GoInt64 GoInt; | |
| typedef struct { const char *p; GoInt n; } GoString; | |
| extern GoInt Authenticate(GoString p0); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package main | |
| import "C" | |
| //export Authenticate | |
| func Authenticate(token string) int { | |
| // Here you can write your authentication code. | |
| // For demo purposes , let us compare the token with a hardcoded string "abc" | |
| if token == "abc" { | |
| return 1 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "status": "Pass", | |
| "dependencies":[ | |
| { | |
| "Name":"isOracleUp", | |
| "status":"Pass" | |
| }, | |
| { | |
| "Name":"isRedisUp", | |
| "status":"Pass" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | /* | |
| ******************************************************************************** | |
| Golang - Asterisk and Ampersand Cheatsheet | |
| ******************************************************************************** | |
| Also available at: https://play.golang.org/p/lNpnS9j1ma | |
| Allowed: | |
| -------- | |
| p := Person{"Steve", 28} stores the value |