-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide
logout
command and update deps. (#139)
- Loading branch information
Showing
8 changed files
with
192 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/metal-stack/metal-lib/auth" | ||
"github.com/metal-stack/metalctl/pkg/api" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func newLogoutCmd(c *config) *cobra.Command { | ||
logoutCmd := &cobra.Command{ | ||
Use: "logout", | ||
Short: "logout user from OIDC SSO session", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
ctx := api.MustDefaultContext() | ||
|
||
err := auth.Logout(&auth.LogoutParams{ | ||
IssuerURL: ctx.IssuerURL, | ||
Logger: c.log, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println("OIDC session successfully logged out. Token is not revoked and is valid until expiration.") | ||
|
||
return nil | ||
}, | ||
PreRun: bindPFlags, | ||
} | ||
return logoutCmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.