Skip to content

Commit

Permalink
Fixes typo, changes auth identity tag
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanHeilman committed Sep 10, 2024
1 parent e2e25be commit 4fa08bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions auth/plugins/openpubkey/client/opk_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ func init() {

const OPENPUBKEY_OPTION_NAME = "github.com/openpubkey/ssh3-openpubkey_auth"

// impements client-side pubkey-based authentication

// implements client-side openpubkey authentication
type OpenPubkeyAuthOption struct {
issuer string
}
Expand Down
11 changes: 5 additions & 6 deletions auth/plugins/openpubkey/server/server_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
)

const PLUGIN_NAME = "github.com/openpubkey/ssh3-server_openpubkey_auth"
const OPENPUBKEY_TAG = "openpubkey"

func init() {
if err := plugins.RegisterServerAuthPlugin(PLUGIN_NAME, OpenPubkeyAuthPlugin); err != nil {
Expand Down Expand Up @@ -132,17 +133,15 @@ func (v *OpenPubkeyIdentityVerifier) Verify(request *http.Request, base64Convers
return true
}

// OpenPubkeyAuthPlugin takes a username and identityStr from the authorizedIdentity file
// OpenPubkeyAuthPlugin takes a username and identityStr from the authorized_identities file
// and either rejects the identity string or returns a verifier.
func OpenPubkeyAuthPlugin(username string, identityStr string) (auth.RequestIdentityVerifier, error) {
log.Debug().Msgf("OpenPubkey auth plugin: parse identity string %s", identityStr)

identityStrArr := strings.Split(identityStr, " ")
// TODO: "opk" should be a constant
if len(identityStrArr) != 4 || identityStrArr[0] != "opk" {
log.Debug().Msgf("the identity string is not a compatiable openpubkey string, %s", identityStr)
// we should not return an error when the format does not match a public key, we should just return a nil RequestIdentityVerifier
return nil, fmt.Errorf("the identity string is not a compatiable openpubkey string, %s", identityStr)
if len(identityStrArr) != 4 || identityStrArr[0] != OPENPUBKEY_TAG {
log.Debug().Msgf("the identity string is not a compatible openpubkey string, %s", identityStr)
return nil, nil
}
clientId := identityStrArr[1]
issuer := identityStrArr[2]
Expand Down

0 comments on commit 4fa08bf

Please sign in to comment.