mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-02-28 20:02:04 +00:00
Compare commits
2 Commits
v5.0.0-bet
...
nightly
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dea8d72f01 | ||
|
|
43e0f3e713 |
@@ -4,6 +4,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/steveiliop56/tinyauth/internal/utils"
|
"github.com/steveiliop56/tinyauth/internal/utils"
|
||||||
@@ -34,9 +35,37 @@ func createOidcClientCmd() *cli.Command {
|
|||||||
clientId := uuid.String()
|
clientId := uuid.String()
|
||||||
clientSecret := "ta-" + utils.GenerateString(61)
|
clientSecret := "ta-" + utils.GenerateString(61)
|
||||||
|
|
||||||
fmt.Printf("Client Name: %s\n", clientName)
|
uclientName := strings.ToUpper(clientName)
|
||||||
fmt.Printf("Client ID: %s\n", clientId)
|
lclientName := strings.ToLower(clientName)
|
||||||
fmt.Printf("Client Secret: %s\n", clientSecret)
|
|
||||||
|
builder := strings.Builder{}
|
||||||
|
|
||||||
|
// header
|
||||||
|
fmt.Fprintf(&builder, "Created credentials for client %s\n\n", clientName)
|
||||||
|
|
||||||
|
// credentials
|
||||||
|
fmt.Fprintf(&builder, "Client Name: %s\n", clientName)
|
||||||
|
fmt.Fprintf(&builder, "Client ID: %s\n", clientId)
|
||||||
|
fmt.Fprintf(&builder, "Client Secret: %s\n\n", clientSecret)
|
||||||
|
|
||||||
|
// env variables
|
||||||
|
fmt.Fprint(&builder, "Environment variables:\n\n")
|
||||||
|
fmt.Fprintf(&builder, "TINYAUTH_OIDC_CLIENTS_%s_CLIENTID=%s\n", uclientName, clientId)
|
||||||
|
fmt.Fprintf(&builder, "TINYAUTH_OIDC_CLIENTS_%s_CLIENTSECRET=%s\n", uclientName, clientSecret)
|
||||||
|
fmt.Fprintf(&builder, "TINYAUTH_OIDC_CLIENTS_%s_NAME=%s\n\n", uclientName, utils.Capitalize(lclientName))
|
||||||
|
|
||||||
|
// cli flags
|
||||||
|
fmt.Fprint(&builder, "CLI flags:\n\n")
|
||||||
|
fmt.Fprintf(&builder, "--oidc.clients.%s.clientid=%s\n", lclientName, clientId)
|
||||||
|
fmt.Fprintf(&builder, "--oidc.clients.%s.clientsecret=%s\n", lclientName, clientSecret)
|
||||||
|
fmt.Fprintf(&builder, "--oidc.clients.%s.name=%s\n\n", lclientName, utils.Capitalize(lclientName))
|
||||||
|
|
||||||
|
// footer
|
||||||
|
fmt.Fprintln(&builder, "You can use either option to configure your OIDC client. Make sure to save these credentials as there is no way to regenerate them.")
|
||||||
|
|
||||||
|
// print
|
||||||
|
out := builder.String()
|
||||||
|
fmt.Print(out)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func (controller *WellKnownController) OpenIDConnectConfiguration(c *gin.Context
|
|||||||
IDTokenSigningAlgValuesSupported: []string{"RS256"},
|
IDTokenSigningAlgValuesSupported: []string{"RS256"},
|
||||||
TokenEndpointAuthMethodsSupported: []string{"client_secret_basic", "client_secret_post"},
|
TokenEndpointAuthMethodsSupported: []string{"client_secret_basic", "client_secret_post"},
|
||||||
ClaimsSupported: []string{"sub", "updated_at", "name", "preferred_username", "email", "groups"},
|
ClaimsSupported: []string{"sub", "updated_at", "name", "preferred_username", "email", "groups"},
|
||||||
ServiceDocumentation: "https://tinyauth.app/docs/reference/openid",
|
ServiceDocumentation: "https://tinyauth.app/docs/guides/oidc",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user