Compare commits

..

No commits in common. '37519ce75691e87aa82b078ad8e4ed31efdf84ee' and 'a39ce2266cd39d95cff7235a2794e08b52ca3aab' have entirely different histories.

  1. 5
      .dockerignore
  2. 5
      .gitignore
  3. 11
      Dockerfile.dvza
  4. 12
      Dockerfile.his
  5. 13
      Dockerfile.wbx
  6. 2
      cryptoutil/certgen.go
  7. 6
      docker-compose.yaml
  8. 2
      dvzaservice/app/src/Home.js
  9. 34039
      dvzaservice/assets/index.js
  10. 1
      dvzaservice/assets/index.js.map
  11. 3
      dvzaservice/assets/js/index.js
  12. 1
      dvzaservice/assets/js/index.js.map
  13. 14
      dvzaservice/main.go
  14. 4
      dvzaservice/model/db.go
  15. 12
      dvzaservice/openapisrv.go
  16. 7
      dvzaservice/srv.go
  17. 1
      dvzaservice/templates/index.html
  18. 6
      go.mod
  19. 4
      go.sum
  20. 34039
      his/assets/index.js
  21. 1
      his/assets/index.js.map
  22. 3
      his/assets/js/index.js
  23. 1
      his/assets/js/index.js.map
  24. 2
      his/model/db.go
  25. 4
      his/model/models.go
  26. 10
      his/openapiclient.go
  27. 0
      his/patients/cbries.edi
  28. 0
      his/patients/cbries.fhir.json
  29. 0
      his/patients/jkorts.edi
  30. 0
      his/patients/jkorts.fhir.json
  31. 16
      his/srv.go
  32. 6
      sharedmodel/auth.go
  33. 2
      sharedmodel/model.go
  34. 6
      sharedmodel/registration.go
  35. 2
      sharedmodel/service.go
  36. 2
      whiteboxservice/app/src/Home.js
  37. 34039
      whiteboxservice/assets/index.js
  38. 1
      whiteboxservice/assets/index.js.map
  39. 3
      whiteboxservice/assets/js/index.js
  40. 1
      whiteboxservice/assets/js/index.js.map
  41. BIN
      whiteboxservice/bin/amd64/ediviewer
  42. 0
      whiteboxservice/bin/amd64/medeur.json
  43. 0
      whiteboxservice/bin/amd64/template.html
  44. 0
      whiteboxservice/bin/arm64/ediviewer
  45. 1
      whiteboxservice/bin/arm64/medeur.json
  46. 442
      whiteboxservice/bin/arm64/template.html
  47. 17
      whiteboxservice/main.go
  48. 4
      whiteboxservice/model/db.go
  49. 14
      whiteboxservice/openapisrv.go
  50. 6
      whiteboxservice/srv.go
  51. 1
      whiteboxservice/templates/index.html

@ -1,4 +1,5 @@
**/.git **/.git
**/node_modules **/node_modules
**/app **/assets
**/data/data.db **/data/data.db
**/certs

5
.gitignore vendored

@ -1,3 +1,4 @@
node_modules node_modules
data/data.db data.db
certs certs
assets

@ -3,11 +3,12 @@
## ##
## Build ## Build
## ##
FROM golang:1.18-alpine AS build FROM golang:1.19-alpine AS build
RUN apk update RUN apk update
RUN apk upgrade RUN apk upgrade
RUN apk add build-base git RUN apk add build-base git
RUN apk add --update npm
WORKDIR /app WORKDIR /app
@ -20,16 +21,20 @@ WORKDIR /app/dvzaservice
RUN go build -o /app/bin/dvza RUN go build -o /app/bin/dvza
WORKDIR /app/dvzaservice/app
RUN npm i
RUN npx webpack
## ##
## Deploy ## Deploy
## ##
FROM golang:1.18-alpine FROM alpine
WORKDIR / WORKDIR /
COPY ./dvzaservice/assets /assets
COPY ./dvzaservice/templates /templates COPY ./dvzaservice/templates /templates
COPY --from=build /app/bin/dvza ./dvza COPY --from=build /app/bin/dvza ./dvza
COPY --from=build /app/dvzaservice/assets ./assets
RUN adduser -D nonroot RUN adduser -D nonroot
USER nonroot:nonroot USER nonroot:nonroot

@ -3,11 +3,12 @@
## ##
## Build ## Build
## ##
FROM golang:1.18-alpine AS build FROM golang:1.19-alpine AS build
RUN apk update RUN apk update
RUN apk upgrade RUN apk upgrade
RUN apk add build-base git RUN apk add build-base git
RUN apk add --update npm
WORKDIR /app WORKDIR /app
@ -20,16 +21,21 @@ WORKDIR /app/his
RUN go build -o /app/bin/his RUN go build -o /app/bin/his
WORKDIR /app/his/app
RUN npm i
RUN npx webpack
## ##
## Deploy ## Deploy
## ##
FROM golang:1.18-alpine FROM alpine
WORKDIR / WORKDIR /
COPY ./his/assets /assets
COPY ./his/templates /templates COPY ./his/templates /templates
COPY ./his/patients /patients
COPY --from=build /app/bin/his ./his COPY --from=build /app/bin/his ./his
COPY --from=build /app/his/assets ./assets
RUN adduser -D nonroot RUN adduser -D nonroot
USER nonroot:nonroot USER nonroot:nonroot

@ -3,11 +3,12 @@
## ##
## Build ## Build
## ##
FROM golang:1.18-alpine AS build FROM golang:1.19-alpine AS build
RUN apk update RUN apk update
RUN apk upgrade RUN apk upgrade
RUN apk add build-base git RUN apk add build-base git
RUN apk add --update npm
WORKDIR /app WORKDIR /app
@ -20,17 +21,21 @@ WORKDIR /app/whiteboxservice
RUN go build -o /app/bin/wbx RUN go build -o /app/bin/wbx
WORKDIR /app/whiteboxservice/app
RUN npm i
RUN npx webpack
## ##
## Deploy ## Deploy
## ##
FROM golang:1.18-alpine FROM alpine
WORKDIR / WORKDIR /
COPY ./whiteboxservice/assets /assets
COPY ./whiteboxservice/templates /templates COPY ./whiteboxservice/templates /templates
COPY ./whiteboxservice/bin /bin COPY ./whiteboxservice/bin/amd64 /wbxbin
COPY --from=build /app/bin/wbx ./wbx COPY --from=build /app/bin/wbx ./wbx
COPY --from=build /app/whiteboxservice/assets ./assets
RUN adduser -D nonroot RUN adduser -D nonroot
USER nonroot:nonroot USER nonroot:nonroot

@ -1,4 +1,4 @@
package certgen package cryptoutil
import ( import (
"bytes" "bytes"

@ -16,7 +16,7 @@ services:
container_name: okapi_wbx container_name: okapi_wbx
restart: always restart: always
environment: environment:
EXT_ADDR: "okapi_wbx:8888" EXT_ADDR: "okapi_wbx"
BIN_FOLDER: "/wbxbin" BIN_FOLDER: "/wbxbin"
volumes: volumes:
- "./wbx/data:/data" - "./wbx/data:/data"
@ -24,11 +24,11 @@ services:
ports: ports:
- 8085:8085 - 8085:8085
okapi_dvza: okapi_dvza:
image: src.whiteboxsystems.nl/decozo/okapidemo/whitebox image: src.whiteboxsystems.nl/decozo/okapidemo/dvza
container_name: okapi_dvza container_name: okapi_dvza
restart: always restart: always
environment: environment:
EXT_ADDR: "okapi_dvza:9999" EXT_ADDR: "okapi_dvza"
volumes: volumes:
- "./dvza/data:/data" - "./dvza/data:/data"
- "./dvza/certs:/certs" - "./dvza/certs:/certs"

@ -5,7 +5,7 @@ const App = () => {
return ( return (
<div> <div>
<h1 className="t-page-header">Welkom bij DVZA</h1> <h1 className="t-page-header">Welkom bij DVZA</h1>
<p>Dit systeem is beschikbaar op: <code>dvza.openkv.mcsr.nl:9999</code></p> <p>Dit systeem is beschikbaar op: <code>{window.externalUrl}</code></p>
</div> </div>
); );
}; };

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -12,18 +12,20 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
) )
var rpcAddr = "0.0.0.0:9999" var rpcPort = "9999"
var rpcAddr = "0.0.0.0:" + rpcPort
var extRpcAddr = "localhost:" + rpcPort
var uiAddr = "0.0.0.0:9095" var uiAddr = "0.0.0.0:9095"
func loadCert() *tls.Certificate { func loadCert() *tls.Certificate {
_, err := os.Stat("certs/client.crt") _, err := os.Stat("certs/client.crt")
if err != nil { if err != nil {
_, _, certPem, keyPem, err := certgen.GenCert("dvza", "dvza") _, _, certPem, keyPem, err := cryptoutil.GenCert("dvza", "dvza")
if err != nil { if err != nil {
panic(err) panic(err)
@ -84,6 +86,10 @@ func main() {
grpcServer := grpc.NewServer(opts...) grpcServer := grpc.NewServer(opts...)
if ext := os.Getenv("EXT_ADDR"); ext != "" {
extRpcAddr = ext + ":" + rpcPort
}
go func() { go func() {
lis, err := net.Listen("tcp", rpcAddr) lis, err := net.Listen("tcp", rpcAddr)
if err != nil { if err != nil {

@ -4,8 +4,8 @@ import (
"gorm.io/driver/sqlite" "gorm.io/driver/sqlite"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
func GetDB(location string) (*gorm.DB, error) { func GetDB(location string) (*gorm.DB, error) {

@ -13,10 +13,10 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
"src.whiteboxsystems.nl/DECOZO/okapidemo/dvzaservice/model" "src.whiteboxsystems.nl/decozo/okapidemo/dvzaservice/model"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
var errNotAuthorized = fmt.Errorf("Not Authorized") var errNotAuthorized = fmt.Errorf("Not Authorized")
@ -59,7 +59,7 @@ func requireConnection(db *gorm.DB, ctx context.Context) (*sharedmodel.Connectio
if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok { if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok {
item := mtls.State.PeerCertificates[0] item := mtls.State.PeerCertificates[0]
log.Println("request certificate subject:", item.Subject) log.Println("request certificate subject:", item.Subject)
pk, err := certgen.PublicKeyToJWK(item.PublicKey) pk, err := cryptoutil.PublicKeyToJWK(item.PublicKey)
if err != nil { if err != nil {
return nil, errNotAuthorized return nil, errNotAuthorized
} }
@ -240,7 +240,7 @@ func (srv *OkAPIServer) CompleteRegistration(
if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok { if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok {
item := mtls.State.PeerCertificates[0] item := mtls.State.PeerCertificates[0]
pk, err := certgen.PublicKeyToJWK(item.PublicKey) pk, err := cryptoutil.PublicKeyToJWK(item.PublicKey)
if err != nil { if err != nil {
return nil, errNotAuthorized return nil, errNotAuthorized
} }

@ -10,8 +10,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapidemo/dvzaservice/model" "src.whiteboxsystems.nl/decozo/okapidemo/dvzaservice/model"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
type UIService struct { type UIService struct {
@ -69,7 +69,8 @@ func (srv *UIService) init() {
} }
func (srv *UIService) GetIndex(c *gin.Context) { func (srv *UIService) GetIndex(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", gin.H{})
c.HTML(http.StatusOK, "index.html", gin.H{"externalURL": extRpcAddr})
} }
func (srv *UIService) GetConnection(c *gin.Context) { func (srv *UIService) GetConnection(c *gin.Context) {

@ -8,6 +8,7 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script>window.externalUrl = '{{.externalURL}}'</script>
<script src="/assets/js/index.js"></script> <script src="/assets/js/index.js"></script>
</body> </body>
</html> </html>

@ -1,14 +1,16 @@
module src.whiteboxsystems.nl/DECOZO/okapidemo module src.whiteboxsystems.nl/decozo/okapidemo
go 1.18 go 1.18
require ( require (
github.com/gin-gonic/gin v1.8.1 github.com/gin-gonic/gin v1.8.1
github.com/gofrs/uuid v4.2.0+incompatible github.com/gofrs/uuid v4.2.0+incompatible
github.com/lestrrat-go/jwx v1.2.25
google.golang.org/grpc v1.48.0 google.golang.org/grpc v1.48.0
google.golang.org/protobuf v1.28.0 google.golang.org/protobuf v1.28.0
gorm.io/driver/sqlite v1.3.6 gorm.io/driver/sqlite v1.3.6
gorm.io/gorm v1.23.8 gorm.io/gorm v1.23.8
src.whiteboxsystems.nl/decozo/okapi v0.0.5
) )
require ( require (
@ -27,7 +29,6 @@ require (
github.com/lestrrat-go/blackmagic v1.0.0 // indirect github.com/lestrrat-go/blackmagic v1.0.0 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/iter v1.0.1 // indirect github.com/lestrrat-go/iter v1.0.1 // indirect
github.com/lestrrat-go/jwx v1.2.25 // indirect
github.com/lestrrat-go/option v1.0.0 // indirect github.com/lestrrat-go/option v1.0.0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.12 // indirect github.com/mattn/go-sqlite3 v1.14.12 // indirect
@ -42,5 +43,4 @@ require (
golang.org/x/text v0.3.6 // indirect golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
src.whiteboxsystems.nl/DECOZO/okapi v0.0.4 // indirect
) )

@ -229,5 +229,5 @@ gorm.io/gorm v1.23.8 h1:h8sGJ+biDgBA1AD1Ha9gFCx7h8npU7AsLdlkX0n2TpE=
gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
src.whiteboxsystems.nl/DECOZO/okapi v0.0.4 h1:Hn/zWj14zknYYQr2rxkpwgZxpE+lH/qqeBp2RL9A/xY= src.whiteboxsystems.nl/decozo/okapi v0.0.5 h1:iAvxdLSib7M8+LwOufPa1rF5usufzG0Vv2qWp2gjzi0=
src.whiteboxsystems.nl/DECOZO/okapi v0.0.4/go.mod h1:zzd5uxSJdsWDyIu2LOpyBLme9Nvo6GaXsbd1CL7BmDU= src.whiteboxsystems.nl/decozo/okapi v0.0.5/go.mod h1:NTi+fO+ZkB01CVZlCDPiyWjbxEfaiPS2ECBPmu/XWek=

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -4,7 +4,7 @@ import (
"gorm.io/driver/sqlite" "gorm.io/driver/sqlite"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
func GetDB(location string) (*gorm.DB, error) { func GetDB(location string) (*gorm.DB, error) {

@ -4,8 +4,8 @@ import (
"time" "time"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
type ConnectionState string type ConnectionState string

@ -11,10 +11,10 @@ import (
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
"src.whiteboxsystems.nl/DECOZO/okapidemo/his/model" "src.whiteboxsystems.nl/decozo/okapidemo/his/model"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
func toStruct(m map[string]interface{}) *structpb.Struct { func toStruct(m map[string]interface{}) *structpb.Struct {
@ -88,7 +88,7 @@ func (srv *HISServer) register(addr string) (*model.ServiceProvider, error) {
return nil, err return nil, err
} }
jwkBytes, err := certgen.PublicKeyToJWKJson(certgen.ExtractPublicKey(srv.clientCert.PrivateKey)) jwkBytes, err := cryptoutil.PublicKeyToJWKJson(cryptoutil.ExtractPublicKey(srv.clientCert.PrivateKey))
if err != nil { if err != nil {
return nil, err return nil, err

@ -18,17 +18,17 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
"src.whiteboxsystems.nl/DECOZO/okapidemo/his/model" "src.whiteboxsystems.nl/decozo/okapidemo/his/model"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
func loadCert() *tls.Certificate { func loadCert() *tls.Certificate {
_, err := os.Stat("certs/client.crt") _, err := os.Stat("certs/client.crt")
if err != nil { if err != nil {
_, _, certPem, keyPem, err := certgen.GenCert("whitebox", "whitebox") _, _, certPem, keyPem, err := cryptoutil.GenCert("whitebox", "whitebox")
if err != nil { if err != nil {
panic(err) panic(err)
@ -266,7 +266,7 @@ func (srv *HISServer) Authenticate(c *gin.Context) {
raw := "" raw := ""
method := "" method := ""
if len(c.Request.TLS.PeerCertificates) > 0 { if len(c.Request.TLS.PeerCertificates) > 0 {
jwk, err := certgen.PublicKeyToJWK(c.Request.TLS.PeerCertificates[0].PublicKey) jwk, err := cryptoutil.PublicKeyToJWK(c.Request.TLS.PeerCertificates[0].PublicKey)
if err != nil { if err != nil {
log.Printf("Error extracting public key JKW: %v", err) log.Printf("Error extracting public key JKW: %v", err)
@ -568,7 +568,7 @@ func (srv *HISServer) GetPatient(c *gin.Context) {
return return
} }
f, err := os.Open(path.Join("./data/patients", patient.FileBase+".edi")) f, err := os.Open(path.Join("./patients", patient.FileBase+".edi"))
if err != nil { if err != nil {
c.Error(err) c.Error(err)
return return
@ -599,7 +599,7 @@ func (srv *HISServer) GetFHIRPatient(c *gin.Context) {
return return
} }
f, err := os.Open(path.Join("./data/patients", patient.FileBase+".fhir.json")) f, err := os.Open(path.Join("./patients", patient.FileBase+".fhir.json"))
if err != nil { if err != nil {
c.Error(err) c.Error(err)
return return

@ -6,8 +6,8 @@ import (
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
) )
const AuthMethodDecozoMTLS = "http://decozo.org/proto/auth/mtls" const AuthMethodDecozoMTLS = "http://decozo.org/proto/auth/mtls"
@ -56,7 +56,7 @@ func NewAuthConfig(cfg *okapi.ProtocolAuthConfiguration) *AuthConfig {
authConfig.Raw, _ = cfg.GetConfiguration().AsMap()["token"].(string) authConfig.Raw, _ = cfg.GetConfiguration().AsMap()["token"].(string)
case AuthMethodDecozoMTLS: case AuthMethodDecozoMTLS:
k, _ := cfg.GetConfiguration().AsMap()["publicKey"].(string) k, _ := cfg.GetConfiguration().AsMap()["publicKey"].(string)
jwk, _ := certgen.StringToJWK(k) jwk, _ := cryptoutil.StringToJWK(k)
if jwk != nil { if jwk != nil {
rawBytes, _ := jwk.Thumbprint(crypto.SHA256) rawBytes, _ := jwk.Thumbprint(crypto.SHA256)
authConfig.Raw = fmt.Sprintf("%X", rawBytes) authConfig.Raw = fmt.Sprintf("%X", rawBytes)

@ -6,7 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
) )
type Protocol struct { type Protocol struct {

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
) )
type RegistrationStatus string type RegistrationStatus string
@ -35,7 +35,7 @@ func (r *Registration) SetAuthConfig(cfg *okapi.XISAuthConfiguration) error {
switch cfg.Method { switch cfg.Method {
case okapi.XISAuthMethod_mTLS: case okapi.XISAuthMethod_mTLS:
k, err := certgen.StringToJWK(cfg.GetMtlsConfiguration().GetPublicKey()) k, err := cryptoutil.StringToJWK(cfg.GetMtlsConfiguration().GetPublicKey())
if err != nil { if err != nil {
return err return err

@ -5,7 +5,7 @@ import (
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
) )
type ServiceDefinition struct { type ServiceDefinition struct {

@ -5,7 +5,7 @@ const App = () => {
return ( return (
<div> <div>
<h1 className="t-page-header">Welkom bij Whitebox</h1> <h1 className="t-page-header">Welkom bij Whitebox</h1>
<p>Dit systeem is beschikbaar op: <code>wbx.openkv.mcsr.nl:8888</code></p> <p>Dit systeem is beschikbaar op: <code>{window.externalUrl}</code></p>
</div> </div>
); );
}; };

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
{"format":[{"name":"UNB","description":"Interchange header"},{"name":"UNH","description":"Head of message"},{"name":"BGM","children":[{"name":"DTM","description":"Datum aangemaakt"},{"name":"RFF","description":"Referenties"},{"name":"FTX","description":"Bericht afhankelijke mededeling"}],"description":"Begin van het bericht"},{"name":"S01","children":[{"name":"NAD","description":"Naam en adres"},{"name":"ADR","description":"Adres"},{"name":"COM","description":"Telefoon- en fax-nummers"},{"name":"RFF"},{"name":"DTM"},{"name":"LAN"},{"name":"SPR","description":"Type medewerker"},{"name":"QUA","description":"Kwalificatie"},{"name":"FTX","description":"Vrije tekst"}],"description":"Medebehandelaar"},{"name":"S02","children":[{"name":"PNA","description":"Naam van de patient"},{"name":"ADR","description":"Adres-patient"},{"name":"COM","description":"Telefoon- en fax-nummers"},{"name":"RFF","description":"Referenties"},{"name":"DTM","description":"Tijdsindicatie"},{"name":"NAT"},{"name":"LAN"},{"name":"LOC"},{"name":"PDI","description":"Demografische gegevens"},{"name":"QUA","description":"Kwalificatie"},{"name":"STS"},{"name":"INS","description":"Verzekeringsgegevens"},{"name":"REL"},{"name":"FTX","description":"Vrije tekst"},{"name":"S03","children":[{"name":"DTM","description":"Tijdsindicatie"},{"name":"S04","children":[{"name":"CIN","description":"Diagnose signalering of risico-factor"},{"name":"PTY","description":"Prioriteit"},{"name":"RFF","description":"Referentie naar groep 1"},{"name":"FTX","description":"Vrije tekst"},{"name":"DTM","description":"Tijdsindicatie"}],"description":"Medisch kenmerk"},{"name":"S05","children":[{"name":"INV"},{"name":"DTM"}]}],"description":"Contact onafhankelijke medische gegevens"},{"name":"S06","children":[{"name":"DTM","description":"Datum/tijd van een contact"},{"name":"RFF","description":"Verantwoordelijke persoon"},{"name":"S07","children":[{"name":"FTX"},{"name":"PTY","description":"Prioriteit"},{"name":"RFF","description":"Probleem/episode"},{"name":"DTM","description":"Datum/tijd van een contact"}],"description":"Ongeclassificeerde journaalregel"},{"name":"S08","children":[{"name":"INV","description":"Meting identificatie"},{"name":"PTY","description":"Prioriteit"},{"name":"RFF","description":"Probleem/episode"},{"name":"RSL","description":"Resultaat meting"},{"name":"RND","description":"Normaalwaarden"},{"name":"FTX","description":"Resultaat"},{"name":"DTM","description":"Datum/tijd"}],"description":"Metingen"},{"name":"S09","children":[{"name":"CIN","description":"Diagnose"},{"name":"PTY","description":"Prioriteit"},{"name":"RFF","description":"Probleem/episode"},{"name":"FTX","description":"Diagnose in vrije tekst"},{"name":"DTM","description":"Datum/tijd"}],"description":"Diagnoses"},{"name":"S10","children":[{"name":"SPR","description":"Specialisme"},{"name":"PTY","description":"Prioriteit"},{"name":"RFF","description":"Probleem/episode"},{"name":"PRC","description":"Soort verwijzing"},{"name":"FTX","description":"Beschrijving"},{"name":"DTM","description":"Datum/tijd"}],"description":"Verwijzingen of terugverwijzingen"},{"name":"S11","children":[{"name":"CLI","description":"Type therapie"},{"name":"PTY","description":"Prioriteit"},{"name":"RFF","description":"Probleem/episode"},{"name":"FTX","description":"Vrije tekst"},{"name":"QTY","description":"Hoeveelheid"},{"name":"DNL","children":[{"name":"DSG","description":"Dose administration"},{"name":"FTX","description":"Vrije tekst"}],"description":"Dosering Nederlandse stijl"},{"name":"SPC","children":[{"name":"QTY","description":"Hoeveelheid"}],"description":"Afzonderlijke stoffen van recept"},{"name":"CIN","description":"Indicatie"},{"name":"SPR","description":"Specialisme voorschrijver"},{"name":"DTM","description":"Datum/tijd"}],"description":"Therapie"}],"description":"Journaalregel"}],"description":"Pati\u00ebnt"},{"name":"UNT","description":"Einde van het bericht"},{"name":"UNZ","description":"Einde uitwisseling"}]}

@ -0,0 +1,442 @@
<style>
.container { margin: 1em auto; font-size: 12pt; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; }
@media screen and (max-width: 700px) {
.container { width: 700px; }
}
@media screen and (min-width: 1200px) {
.container { width: 1200px; }
}
.container h3 { margin-bottom: 8px; }
.container ul { list-style-type: none; }
.container li + li { margin-top: 10px; }
.container td { vertical-align: top; }
.container .seg { margin-top: 8px; padding: 8px 10px; border: 0 solid #e7e7e7; border-width: 0 1px 1px 1px; }
.container .seg-hdr { margin-top: 8px; border-top-width: 1px; background: #F8F8F8; }
.container .seg-hdr-white { margin-top: 8px; background: #FFFFFF; border-color: transparent; }
.container a { color: royalblue }
.container table.patient th { text-align: left; padding-right: 1em }
.container table.SOEPkind { margin: -6px 0 }
.container table.SOEPkind tr { height: 1em }
.container table.SOEPkind th { text-align: left; width: 32px; height: 1em; font-weight: normal }
.container table.results th { text-align: left }
.container .error { position: fixed; top: 10px; margin-left: 32px; border: 2px solid #000000; background-color: #FF2222; }
.row + .row { margin-top: 4px; }
.table { font-size: 100%; width: 100%; border-spacing: 0; border-collapse: collapse; }
.table tr { font-size: 100% }
.table td { font-size: 100% }
.table th { font-size: 100%; text-align: left; }
.table tbody td { font-size: 100%; text-align: left; padding: 2px 8px 2px 0; }
.table thead th { font-size: 100%; padding: 0 0 2px 0; }
.table tr.highlight { background: #E3E9E3 }
.column-attn { width: 1em; }
.column-code { width: 4em; }
.column-date { width: 6.5em; }
.column-small-name { width: 10em; }
.column-medium-name { width: 14em; }
.column-large-name { width: 28em; }
.column-name { width: 20em; }
.column-instr{ width: 15em; }
.column-quantity { width: 12em; }
.no-margin { margin-bottom: 0px; }
.seg-date { float: left; width: 6.5em; }
.seg-content-offset { margin-left: 6.5em }
.column-result-id { width: 16em }
.column-result-name { width: 10em }
.container h3.fold-toggle { margin-bottom: 8px }
.container h4.fold-toggle { margin-bottom: 0; margin-top: 4px }
.container h3.fold-toggle.fold-toggle-hidden { margin-bottom: 0 }
.container h4.fold-toggle.fold-toggle-hidden { margin-bottom: 4px }
.fold-toggle .fold-marker:before,
.container h3.fold-toggle:before,
.container h4.fold-toggle:before { content: "▾ " }
.fold-toggle.fold-toggle-hidden .fold-marker:before,
.container h3.fold-toggle.fold-toggle-hidden:before,
.container h4.fold-toggle.fold-toggle-hidden:before { content: "▸ " }
.fold-toggle { cursor: pointer; }
.fold-hidden {display: none}
.hidden
{
display: none !important
}
.container textarea
{
border: 1px solid #333;
padding: .5em;
font-size: 100%
}
.container input[type=submit]
{
font-size: 90%;
padding: .25em
}
.container button
{
font-size: 75%;
padding: .25em
}
</style>
<div class="container">
{{define "person-row"}}
<tr id="person-{{.Anchor}}">
<td class="column-small-name">{{if .Name}}{{.Name}}{{else}}<em>Geen naam</em>{{end}}</td>
<td class="column-small-name">{{.Function}}</td>
<td class="column-medium-name">{{.Address}}</td>
<td class="column-small-name">{{if .AGB}}AGB: {{.AGB}}{{end}}</td>
</tr>{{end}}
{{define "medi-group-epi"}}
{{$root := .}}
<table class="table">
<thead>
<tr>
<th class="column-date">Datum</th>
<th class="column-code">Type</th>
<th class="column-date">ICPC</th>
<th class="column-name">Beschrijving</th>
{{if eq .Extra.verbose_icpc_description "true"}}
<th class="column-desc">Beschrijving arts</th>
{{else}}
{{end}}
<th class="column-desc"></th>
</tr>
</thead>
<tbody>
{{range .Episodes}}
<tr{{if .Anchor}} id="medigroup-{{.Anchor}}"{{end}}>
<td>{{.Date}}</td>
<td>{{.Type}}</td>
<td>{{.ICPC}}</td>
{{if eq $root.Extra.verbose_icpc_description "true"}}
<td>{{.Title}}</td>
<td>{{.Description}}</td>
{{else}}
{{if eq .Description ""}}
<td colspan="2">{{.Title}}</td>
{{else}}
<td colspan="2">{{.Description}}</td>
{{end}}
{{end}}
</tr>{{end}}
</tbody>
</table>
{{end}}
{{define "medi-group-ica"}}
{{$root := .}}
<table class="table">
<thead>
<tr>
<th class="column-date">Datum</th>
<th class="column-code">Type</th>
<th class="column-date">ICPC</th>
<th class="column-name" colspan="2">Beschrijving</th>
{{if eq $root.Extra.verbose_icpc_description "true"}}
<th class="column-desc"></th>
{{else}}
{{end}}
</tr>
</thead>
<tbody>
{{range .Indicators}}
<tr{{if .Anchor}} id="medigroup-{{.Anchor}}"{{end}}>
<td>{{.Date}}</td>
<td>{{.Type}}</td>
<td>{{.ICPC}}</td>
<td>{{.Title}}</td>
{{if eq $root.Extra.verbose_icpc_description "true"}}
<td>{{.Description}}</td>
{{else}}
<td></td>
{{end}}
</tr>{{end}}
</tbody>
</table>
{{end}}
<div class="seg seg-hdr" data-his="{{.HIS}}">
<h3>Huisarts</h3>
<table class="table">
{{template "person-row" .GP}}
{{if .Pharmacy.Anchor}}{{template "person-row" .Pharmacy}}{{end}}
</table>
{{if .Practitioners}}
<h4 data-fold-toggle="practicioners" data-fold-hide="1">Medebehandelaren</h4>
<div data-fold="practicioners">
<table class="table">{{range .Practitioners}}
{{template "person-row" .}}{{end}}
</table>
</div>
{{end}}
</div>
<div class="seg seg-hdr">
<h3>Patiënt</h3>
<table class="patient">
<tr>
<th>Naam:
<td>{{.Patient.Name}}
{{if .Patient.BSN}}
<tr>
<th>BSN:
<td>{{.Patient.BSN}}
{{end}}
<tr>
<th>Geboortedatum:
<td>{{.Patient.Birthdate}}
<tr>
<th>Adres:
<td>{{.Patient.Address}}
<tr>
<th>Geslacht:
<td>{{.Patient.Gender}}
{{range .Patient.OtherFields}}
<tr>
<th>{{.Key}}:
<td{{if eq .Key "Toegepast filter"}} title="Een filter is een (standaard) filter dat door een huisarts over alle of een deel van de patiëntendossiers wordt toegepast. De minimale professionele samenvatting (PS) bevat een samenvatting van alleen zeer recente informatie uit het huisartsdossier, met alleen actuele / chronische medicatie. Dit is minder informatie dan de standaard NHG PS, die journaalregels tot 4 maanden terug, of de laatste 5 consultverslagen kan bevatten. Houd er svp rekening mee dat geen enkel type PS alle, of gegarandeerd volledige of correcte informatie bevat."{{end}}>{{.Value}}
{{end}}
</table>
</div>
{{if .Memo}}
<div class="seg seg-hdr">
<h3>Memo</h3>
{{.Memo}}
</div>
{{end}}
{{if .Episodes}}
<div class="seg seg-hdr">
<h3>Episodelijst</h3>
{{template "medi-group-epi" .}}
</div>
{{end}}
{{if .Indicators}}
<div class="seg seg-hdr">
<h3>Contra-indicaties, interacties en allergie&#235;n</h3>
{{template "medi-group-ica" .}}
</div>
{{end}}
{{if .Medication}}
<div class="seg seg-hdr">
<h3 data-fold-toggle="med-table">Medicatieoverzicht</h3>
<table data-fold="med-table" class="table">
<thead>
<tr>
<th class="column-large-name">Recept</th>
<th class="column-instr">Gebruiksvoorschrift</th>
<th class="column-quantity">Hoeveelheid</th>
<th class="column-date">Ingang</th>
<th class="column-date">Vervalt</th>
</tr>
</thead>
<tbody>
{{range $index, $med := .Medication}}
{{if gt (len $med.Fold) 1}}
<tr data-fold-toggle="medfold-{{$index}}" data-fold-hide="1">
<td>{{$med.Recipe}}</td>
<td>{{$med.Instructions}}</td>
<td>{{ YieldDosage $med }}</td>
<td>{{$med.StartDate}}</td>
<td>{{$med.EndDate}}</td>
</tr>
{{range $fold := $med.Fold}}
<tr data-fold="medfold-{{$index}}">
<td></td>
<td>{{ if ne $med.Instructions $fold.Instructions}}{{$fold.Instructions}}{{else}}{{end}}</td>
<td>{{ YieldDosage $fold }}</td>
<td>{{$fold.StartDate}}</td>
<td>{{$fold.EndDate}}</td>
</tr>
{{end}}
{{else}}
<tr>
<td>{{$med.Recipe}}</td>
<td>{{$med.Instructions}}</td>
<td>{{ YieldDosage $med }}</td>
<td>{{$med.StartDate}}</td>
<td>{{$med.EndDate}}</td>
</tr>
{{end}}
{{end }}
</tbody>
</table>
</div>
{{end}}
{{if .Journal}}
<div class="seg seg-hdr-white">
<h3>Journaal</h3>
</div>
{{range .Journal}}
<div class="seg seg-hdr">
<div class="seg-date">{{.Date}}</div>
<div class="seg-content-offset" title="{{.AuthorName}}{{if .Kind}} ({{.Kind}}){{end}}">
{{if .Results}}
<div class="row">
<table class="results">
<thead>
<tr>
<th class="column-result-id">Identificatie</th>
<th class="column-result-name">Resultaat</th>
<th class="column-result-desc">Beschrijving</th>
</tr>
</thead>
<tbody>
{{range .Results}}
<tr {{if .Episode}}data-episode="{{.Episode}}"{{end}}><td>{{.Kind}}</td>
<td>{{.Result}}</td>
<td>{{if eq .Identification "Buiten normaalwaarde"}}<strong>{{.Identification}}</strong>{{else}}{{.Identification}}{{end}}
{{if and .Identification .Description}}<br>{{end}}
{{.Description}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
{{range .Lines}}
<div class="row"{{if .Episode}} data-episode="{{.Episode}}"{{end}}>
<table class="SOEPkind">
<tr>
{{if .SOEP}}
<th style="padding-top: 10px; vertical-align: top;">{{.SOEP}}:
<td style="padding-top: 10px; vertical-align: top;">{{ConvertLinebreaks .Text}}
{{end}}
{{if .Kind}}
<th style="padding-top: 10px; vertical-align: top;">{{.Kind}}{{if .Text}}:{{end}}
<td style="padding-top: 10px; vertical-align: top;">{{ConvertLinebreaks .Text}}
{{end}}
</tr>
</table>
</div>
{{end}}
</div>
</div>
{{end}}
{{end}}
{{if .Extra.csrf_token }}
<div class="seg seg-hdr-white">
<br>
<h3 id="feedback-header"><button onClick="feedbackHeaderClicked()">Notitie schrijven</button></h3>
<form id="feedback-form" class="hidden" method="POST" onSubmit="sendFeedback(); return false"> <!-- TODO: contruct proper URL in golang -->
<input type="hidden" name="csrf_token" value="{{.Extra.csrf_token}}" id="csrf">
<p><br><textarea id="feedback-textarea" rows="7" cols="50"></textarea>
<p><br><input type="submit" value="Opsturen">
</form>
</div>
{{end}}
</div>
<script>
(function() {
var folds = document.querySelectorAll('[data-fold-toggle]');
for (var i = 0; i < folds.length; i++) {
(function(btn) {
var t = btn.getAttribute('data-fold-toggle');
var fds = document.querySelectorAll('[data-fold="' + t + '"]');
btn.classList.add('fold-toggle');
var hidden = false;
var sync = function() {
if (hidden) {
btn.classList.add('fold-toggle-hidden');
} else {
btn.classList.remove('fold-toggle-hidden');
}
for (var j = 0; j < fds.length; j++) {
var e = fds[j].classList;
if (hidden) {
e.add('fold-hidden');
} else {
e.remove('fold-hidden');
}
}
setTimeout(send_height_to_parent, 0);
};
if (btn.getAttribute('data-fold-hide') == '1') {
hidden = true;
}
btn.addEventListener('click', function() {
hidden = !hidden;
sync();
});
sync();
})(folds[i]);
}
})();
function feedbackHeaderClicked()
{
toggle('feedback-form')
var textarea = document.getElementById('feedback-textarea')
textarea.focus()
}
function toggle(id)
{
var elem = document.getElementById(id)
if (elem)
{
var className = elem.getAttribute('class')
if (className == 'hidden')
{
elem.setAttribute('class', '')
}
else
{
elem.setAttribute('class', 'hidden')
}
}
}
function getXMLHttpRequest()
{
if (window.XMLHttpRequest)
{
return new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
return new ActiveXObject('Microsoft.XMLHTTP')
}
}
</script></body></html>

@ -12,19 +12,22 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
) )
var srvaddr = "0.0.0.0:8888" var rpcPort = "8888"
var srvaddr = "0.0.0.0:" + rpcPort
var extRpcAddr = "localhost:" + rpcPort
var patientIf = "0.0.0.0:8085" var patientIf = "0.0.0.0:8085"
var binFolder = "./bin"
var binFolder = "./bin/arm64"
func loadCert() *tls.Certificate { func loadCert() *tls.Certificate {
_, err := os.Stat("certs/client.crt") _, err := os.Stat("certs/client.crt")
if err != nil { if err != nil {
_, _, certPem, keyPem, err := certgen.GenCert("whitebox", "whitebox") _, _, certPem, keyPem, err := cryptoutil.GenCert("whitebox", "whitebox")
if err != nil { if err != nil {
panic(err) panic(err)
@ -71,6 +74,10 @@ func main() {
binFolder = os.Getenv("BIN_FOLDER") binFolder = os.Getenv("BIN_FOLDER")
} }
if ext := os.Getenv("EXT_ADDR"); ext != "" {
extRpcAddr = ext + ":" + rpcPort
}
openapisrv := NewServer() openapisrv := NewServer()
openapisrv.LoadData("./data/data.db") openapisrv.LoadData("./data/data.db")
opts := []grpc.ServerOption{ opts := []grpc.ServerOption{

@ -4,8 +4,8 @@ import (
"gorm.io/driver/sqlite" "gorm.io/driver/sqlite"
"gorm.io/gorm" "gorm.io/gorm"
"gorm.io/gorm/logger" "gorm.io/gorm/logger"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
) )
func GetDB(location string) (*gorm.DB, error) { func GetDB(location string) (*gorm.DB, error) {

@ -14,10 +14,10 @@ import (
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapi" "src.whiteboxsystems.nl/decozo/okapi"
"src.whiteboxsystems.nl/DECOZO/okapidemo/certgen" "src.whiteboxsystems.nl/decozo/okapidemo/cryptoutil"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
"src.whiteboxsystems.nl/DECOZO/okapidemo/whiteboxservice/model" "src.whiteboxsystems.nl/decozo/okapidemo/whiteboxservice/model"
) )
var errNotAuthorized = fmt.Errorf("Not Authorized") var errNotAuthorized = fmt.Errorf("Not Authorized")
@ -61,7 +61,7 @@ func requireConnection(db *gorm.DB, ctx context.Context) (*sharedmodel.Connectio
if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok { if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok {
item := mtls.State.PeerCertificates[0] item := mtls.State.PeerCertificates[0]
log.Println("request certificate subject:", item.Subject) log.Println("request certificate subject:", item.Subject)
pk, err := certgen.PublicKeyToJWK(item.PublicKey) pk, err := cryptoutil.PublicKeyToJWK(item.PublicKey)
if err != nil { if err != nil {
return nil, errNotAuthorized return nil, errNotAuthorized
} }
@ -224,7 +224,7 @@ func (srv *OkAPIServer) CompleteRegistration(
if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok { if mtls, ok := p.AuthInfo.(credentials.TLSInfo); ok {
item := mtls.State.PeerCertificates[0] item := mtls.State.PeerCertificates[0]
pk, err := certgen.PublicKeyToJWK(item.PublicKey) pk, err := cryptoutil.PublicKeyToJWK(item.PublicKey)
if err != nil { if err != nil {
return nil, errNotAuthorized return nil, errNotAuthorized
} }
@ -307,7 +307,7 @@ func (srv *OkAPIServer) EnableService(
AuthConfig: sharedmodel.NewAuthConfig(in.Fetch.Auth), AuthConfig: sharedmodel.NewAuthConfig(in.Fetch.Auth),
} }
publicKey, err := certgen.PublicKeyToJWKJson(certgen.ExtractPublicKey(srv.clientCert.PrivateKey)) publicKey, err := cryptoutil.PublicKeyToJWKJson(cryptoutil.ExtractPublicKey(srv.clientCert.PrivateKey))
if err != nil { if err != nil {
return nil, fmt.Errorf("Error retrieving pub key: %v", err) return nil, fmt.Errorf("Error retrieving pub key: %v", err)

@ -13,8 +13,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gorm.io/gorm" "gorm.io/gorm"
"src.whiteboxsystems.nl/DECOZO/okapidemo/sharedmodel" "src.whiteboxsystems.nl/decozo/okapidemo/sharedmodel"
"src.whiteboxsystems.nl/DECOZO/okapidemo/whiteboxservice/model" "src.whiteboxsystems.nl/decozo/okapidemo/whiteboxservice/model"
) )
type UIService struct { type UIService struct {
@ -70,7 +70,7 @@ func (srv *UIService) init() {
} }
func (srv *UIService) GetIndex(c *gin.Context) { func (srv *UIService) GetIndex(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", gin.H{}) c.HTML(http.StatusOK, "index.html", gin.H{"externalURL": extRpcAddr})
} }
func (srv *UIService) GetConnection(c *gin.Context) { func (srv *UIService) GetConnection(c *gin.Context) {

@ -8,6 +8,7 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script>window.externalUrl = '{{.externalURL}}'</script>
<script src="/assets/js/index.js"></script> <script src="/assets/js/index.js"></script>
</body> </body>
</html> </html>
Loading…
Cancel
Save