Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
IRMA
Github mirrors
irmago
Commits
02ea4239
Commit
02ea4239
authored
Feb 06, 2019
by
Sietse Ringers
Browse files
Change package structure
parent
57897fbd
Changes
7
Hide whitespace changes
Inline
Side-by-side
server/irmad/cmd/check.go
View file @
02ea4239
package
main
package
cmd
import
(
"encoding/json"
"github.com/go-errors/errors"
"github.com/privacybydesign/irmago/server/
irmad
"
"github.com/privacybydesign/irmago/server/
requestorserver
"
"github.com/spf13/cobra"
)
...
...
@@ -24,7 +24,7 @@ Specify -v to see the configuration.`,
download
:=
conf
.
DownloadDefaultSchemes
conf
.
SchemeUpdateInterval
=
0
// Hack: put this to 0 to prevent verifyConfiguration() from immediately updating schemes
conf
.
DownloadDefaultSchemes
=
false
// and this to false to prevent default scheme downloading
if
_
,
err
:=
irmad
.
New
(
conf
);
err
!=
nil
{
if
_
,
err
:=
requestorserver
.
New
(
conf
);
err
!=
nil
{
die
(
errors
.
WrapPrefix
(
err
,
"Invalid configuration"
,
0
))
}
conf
.
SchemeUpdateInterval
=
interval
// restore previous values before printing configuration
...
...
server/irmad/cmd/
main
.go
→
server/irmad/cmd/
root
.go
View file @
02ea4239
// Executable for the irmad.
package
main
package
cmd
import
(
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/go-errors/errors"
"github.com/privacybydesign/irmago/server"
"github.com/privacybydesign/irmago/server/
irmad
"
"github.com/privacybydesign/irmago/server/
requestorserver
"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/x-cray/logrus-prefixed-formatter"
)
var
logger
=
logrus
.
StandardLogger
()
var
conf
*
irmad
.
Configuration
var
conf
*
requestorserver
.
Configuration
var
RootCommand
=
&
cobra
.
Command
{
Use
:
"irmad"
,
...
...
@@ -26,7 +27,7 @@ var RootCommand = &cobra.Command{
if
err
:=
configure
(
command
);
err
!=
nil
{
die
(
errors
.
WrapPrefix
(
err
,
"Failed to read configuration"
,
0
))
}
serv
,
err
:=
irmad
.
New
(
conf
)
serv
,
err
:=
requestorserver
.
New
(
conf
)
if
err
!=
nil
{
die
(
errors
.
WrapPrefix
(
err
,
"Failed to configure server"
,
0
))
}
...
...
@@ -36,17 +37,12 @@ var RootCommand = &cobra.Command{
},
}
func
main
()
{
logger
.
Level
=
logrus
.
InfoLevel
logger
.
SetFormatter
(
&
prefixed
.
TextFormatter
{
FullTimestamp
:
true
,
})
if
err
:=
setFlags
(
RootCommand
);
err
!=
nil
{
die
(
errors
.
WrapPrefix
(
err
,
"Failed to attach flags to "
+
RootCommand
.
Name
()
+
" command"
,
0
))
}
// Execute adds all child commands to the root command sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func
Execute
()
{
if
err
:=
RootCommand
.
Execute
();
err
!=
nil
{
die
(
errors
.
WrapPrefix
(
err
,
"Failed to execute command"
,
0
))
fmt
.
Println
(
err
)
os
.
Exit
(
-
1
)
}
}
...
...
@@ -178,7 +174,7 @@ func configure(cmd *cobra.Command) error {
}
// Read configuration from flags and/or environmental variables
conf
=
&
irmad
.
Configuration
{
conf
=
&
requestorserver
.
Configuration
{
Configuration
:
&
server
.
Configuration
{
DownloadDefaultSchemes
:
true
,
// If we get passed an empty schemes-path, download default schemes into it
SchemesPath
:
viper
.
GetString
(
"schemes-path"
),
...
...
@@ -188,7 +184,7 @@ func configure(cmd *cobra.Command) error {
URL
:
viper
.
GetString
(
"url"
),
Logger
:
logger
,
},
Permissions
:
irmad
.
Permissions
{
Permissions
:
requestorserver
.
Permissions
{
Disclosing
:
handlePermission
(
"disclose-perms"
),
Signing
:
handlePermission
(
"sign-perms"
),
Issuing
:
handlePermission
(
"issue-perms"
),
...
...
@@ -198,7 +194,7 @@ func configure(cmd *cobra.Command) error {
ClientListenAddress
:
viper
.
GetString
(
"client-listen-addr"
),
ClientPort
:
viper
.
GetInt
(
"client-port"
),
DisableRequestorAuthentication
:
viper
.
GetBool
(
"no-auth"
),
Requestors
:
make
(
map
[
string
]
irmad
.
Requestor
),
Requestors
:
make
(
map
[
string
]
requestorserver
.
Requestor
),
JwtIssuer
:
viper
.
GetString
(
"jwt-issuer"
),
JwtPrivateKey
:
viper
.
GetString
(
"jwt-privkey"
),
JwtPrivateKeyFile
:
viper
.
GetString
(
"jwt-privkey-file"
),
...
...
server/irmad/cmd/run.go
View file @
02ea4239
package
main
package
cmd
import
(
"github.com/go-errors/errors"
...
...
server/irmad/main.go
0 → 100644
View file @
02ea4239
// Executable for the irmad.
package
main
import
"github.com/privacybydesign/irmago/server/irmad/cmd"
func
main
()
{
cmd
.
Execute
()
}
server/
irmad
/auth.go
→
server/
requestorserver
/auth.go
View file @
02ea4239
package
irmad
package
requestorserver
import
(
"net/http"
...
...
server/
irmad
/conf.go
→
server/
requestorserver
/conf.go
View file @
02ea4239
package
irmad
package
requestorserver
import
(
"crypto/rsa"
...
...
server/
irmad
/server.go
→
server/
requestorserver
/server.go
View file @
02ea4239
...
...
@@ -2,7 +2,7 @@
// applications (the requestor) to perform IRMA sessions with irmaclient instances (i.e. the IRMA
// app). It exposes a RESTful protocol with which the requestor can start and manage the session as
// well as HTTP endpoints for the irmaclient.
package
irmad
package
requestorserver
import
(
"crypto/tls"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment