Commit f4fa4339 authored by Lukas Burgey's avatar Lukas Burgey

Add stub script

parent b8c81ed6
......@@ -97,7 +97,13 @@ const (
)
func (u User) String() string {
return u.Email
if email, ok := u.UserInfo["email"]; ok {
return email.(string)
}
if name, ok := u.UserInfo["name"]; ok {
return name.(string)
}
return ""
}
func (k SSHKey) String() string {
......
#!/bin/sh
# user creation
curl --basic -u hdfrest:hdfrest555634 -H "Content-Type: application/json" -X POST -d '{"externalId":"test0002"}' https://bwidm-test.scc.kit.edu/rest/external-user/create
# user update
curl --basic -u hdfrest:hdfrest555634 -H "Content-Type: application/json" -X POST -d
'{"externalId":"test0002","eppn":"test0002@hdf.de","email":"test-diezweite@kit.edu","genericStore":{"testkey":"testvalue24"},"surName":"Testfamilie","givenName":"Hans","primaryGroup":{"id":1002637},"attributeStore":{"urn:oid:0.9.2342.19200300.100.1.1":"test0002","http://bwidm.de/bwidmOrgId":"hdf"}}'\
https://bwidm-test.scc.kit.edu/rest/external-user/update
curl --basic -u hdfrest:hdfrest555634 https://bwidm-test.scc.kit.edu/rest/external-user/find/externalId/test0002
curl --basic -u hdfrest:hdfrest555634 https://bwidm-test.scc.kit.edu/rest/external-reg/register/externalId/test0002/ssn/sshtest
BindDN:
uid=fileservice-read,ou=admin,ou=login-test,dc=bwidm-test,dc=de
BindPW:
hdfrest555634
Base:
ou=login-test,dc=bwidm-test,dc=de
#!/bin/sh
root='https://bwidm-test.scc.kit.edu/rest/external-user'
userName=foobar
user=hdfrest
pw=hdfrest555634
curl --basic -u hdfrest:hdfrest555634 -H "Content-Type: application/json" -X POST -d '{"externalId":
"test0002"}' https://bwidm-test.scc.kit.edu/rest/external-user/create
http -va $user:$pw ${root}/find/externalId/$1
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
s "git.scc.kit.edu/fum/feudalScripts"
)
const (
version = "0.1.0"
)
var (
httpClient = &http.Client{}
)
func check(err error) {
if err != nil {
log.Fatal(err)
}
}
func deploy(input s.Input) (output s.Output, err error) {
output.State = s.Deployed
output.Msg = "deployed"
output.Credentials = map[string]string{
"password": "stub password",
"url": "stub.kit.de",
}
return
}
func withdraw(input s.Input) (output s.Output, err error) {
output.State = s.NotDeployed
output.Msg = "stub remove"
return
}
func handleInput() (output s.Output, err error) {
inputBytes, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return
}
input, err := s.UnmarshalInput(inputBytes)
if err != nil {
return
}
switch input.StateTarget {
case "deployed":
output, err = deploy(input)
case "not_deployed":
output, err = withdraw(input)
default:
err = fmt.Errorf("Not implemented")
}
return
}
func main() {
log.SetOutput(os.Stderr)
output, err := handleInput()
if err != nil {
output = s.Output{
State: s.Failed,
Msg: fmt.Sprintf("%s", err),
}
}
outputBytes, err := json.MarshalIndent(output, "", " ")
fmt.Fprintf(os.Stdout, "%s", outputBytes)
}
#!/bin/sh
root='https://bwidm-test.scc.kit.edu/rest/external-user'
user=hdfrest
pw=hdfrest555634
#curl --basic -u hdfrest:hdfrest555634 -H "Content-Type: application/json" -X POST -d '{"externalId":
# "test0002"}' https://bwidm-test.scc.kit.edu/rest/external-user/create
http -va $user:$pw ${root}/find/externalId/$1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment