Explorar el Código

Add Session.SetHTTPBasicAuth

This is not 100% idiot-proof, but still makes it mroe difficult for
plugins to steal credentials.
master
Simon Ser hace 4 años
padre
commit
425445f443
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: FDE7BE0E88F5E48
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. +8
    -0
      session.go

+ 8
- 0
session.go Ver fichero

@@ -7,6 +7,7 @@ import (
"fmt"
"sync"
"time"
"net/http"

imapclient "github.com/emersion/go-imap/client"
"github.com/emersion/go-sasl"
@@ -104,6 +105,13 @@ func (s *Session) DoSMTP(f func(*smtp.Client) error) error {
return nil
}

// SetHTTPBasicAuth adds an Authorization header field to the request with
// this session's credentials.
func (s *Session) SetHTTPBasicAuth(req *http.Request) {
// TODO: find a way to make it harder for plugins to steal credentials
req.SetBasicAuth(s.username, s.password)
}

// Close destroys the session. This can be used to log the user out.
func (s *Session) Close() {
select {


Cargando…
Cancelar
Guardar