...

Source file src/github.com/godbus/dbus/v5/auth_external.go

Documentation: github.com/godbus/dbus/v5

     1  package dbus
     2  
     3  import (
     4  	"encoding/hex"
     5  )
     6  
     7  // AuthExternal returns an Auth that authenticates as the given user with the
     8  // EXTERNAL mechanism.
     9  func AuthExternal(user string) Auth {
    10  	return authExternal{user}
    11  }
    12  
    13  // AuthExternal implements the EXTERNAL authentication mechanism.
    14  type authExternal struct {
    15  	user string
    16  }
    17  
    18  func (a authExternal) FirstData() ([]byte, []byte, AuthStatus) {
    19  	b := make([]byte, 2*len(a.user))
    20  	hex.Encode(b, []byte(a.user))
    21  	return []byte("EXTERNAL"), b, AuthOk
    22  }
    23  
    24  func (a authExternal) HandleData(b []byte) ([]byte, AuthStatus) {
    25  	return nil, AuthError
    26  }
    27  

View as plain text