Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Schürg
actl
Commits
93fe155d
Commit
93fe155d
authored
Nov 10, 2020
by
Simon Schürg
🚀
Browse files
Add LoginProfile
parent
96a7282c
Changes
1
Hide whitespace changes
Inline
Side-by-side
cmd/login.go
View file @
93fe155d
...
...
@@ -41,12 +41,34 @@ type refreshCredentials struct {
refreshToken
string
}
// type LoginProfile struct {
// LoginType string
// Issuer string
// ClientID string
// Username string
// Password string
// // ClientSecret string
// }
type
LoginProfile
struct
{
LoginType
string
`toml:"login_type"`
Issuer
string
`toml:"issuer"`
ClientID
string
`toml:"client_id"`
Username
string
`toml:"username"`
Password
string
`toml:"password"`
}
var
loginCmd
=
&
cobra
.
Command
{
Use
:
"login"
,
Short
:
"Performs an OpenID Connect Login and retrieve tokens."
,
Long
:
`Performs an OpenID Connect Login and retrieve two JWT - an access token and a refresh token.`
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
if
profile
==
""
{
if
profile
!=
""
{
// rawProfile := viper.Get(fmt.Sprintf("logins.%s", profile))
var
profileBla
LoginProfile
viper
.
UnmarshalKey
(
fmt
.
Sprintf
(
"logins.%s"
,
profile
),
profileBla
)
fmt
.
Printf
(
"%s"
,
profileBla
.
ClientID
)
fmt
.
Printf
(
"The login command requires either a subcommand or the profile flag to be set.
\n\n
"
)
cmd
.
Help
()
os
.
Exit
(
1
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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