session

package
v0.0.0-...-9474aff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package session interacts with session_manager.

Index

Constants

View Source
const (
	// PolicyPath is a directory containing policy files.
	PolicyPath = "/var/lib/devicesettings"
)

Variables

This section is empty.

Functions

func BuildPolicy

BuildPolicy creates PolicyFetchResponse used in session_manager from the given parameters.

func ClearDeviceOwnership

func ClearDeviceOwnership(ctx context.Context) error

ClearDeviceOwnership deletes DUT's ownership infomation.

func DevicePolicyDescriptor

func DevicePolicyDescriptor() *lm.PolicyDescriptor

DevicePolicyDescriptor creates a PolicyDescriptor suitable for storing and retrieving device policy using session_manager's policy storage interface.

func ExtractPrivKey

func ExtractPrivKey(path string) (*rsa.PrivateKey, error)

ExtractPrivKey reads a PKCS #12 format file at path, then extracts and returns RSA private key.

func GetSessionManagerPID

func GetSessionManagerPID() (int, error)

GetSessionManagerPID returns the PID of the session_manager.

func NormalizeEmail

func NormalizeEmail(email string, removeDots bool) (string, error)

NormalizeEmail normalizes the supplied email address as would be done for GAIA login. The address is lowercased, periods in the username are removed, and a gmail.com domain is appended if needed.

func PrepareChromeForPolicyTesting

func PrepareChromeForPolicyTesting(ctx context.Context, m *SessionManager) error

PrepareChromeForPolicyTesting prepares Chrome for ownership or policy tests. This prevents a crash on startup due to synchronous profile creation and not knowing whether to expect policy, see https://crbug.com/950812. Waits for the new chrome browser to start so that when test calls StartSession, it is not picked up by chrome. Otherwise, chrome crashes because it does not know the test user. See https://crbug.com/1166265.

func RetrieveSettings

RetrieveSettings requests to given SessionManager to return the currently stored ChromeDeviceSettingsProto.

func SetUpDevice

func SetUpDevice(ctx context.Context) error

SetUpDevice prepares the device for ownership & policy related tests.

func StoreSettings

StoreSettings requests given SessionManager to store the ChromeDeviceSettingsProto data for the user with key.

Types

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

SessionManager is used to interact with the session_manager process over D-Bus. For detailed spec of each D-Bus method, please find src/platform2/login_manager/dbus_bindings/org.chromium.SessionManagerInterface.xml

func NewSessionManager

func NewSessionManager(ctx context.Context) (*SessionManager, error)

NewSessionManager connects to session_manager via D-Bus and returns a SessionManager object.

func (*SessionManager) EnableChromeTesting

func (m *SessionManager) EnableChromeTesting(ctx context.Context, forceRelaunch bool,
	extraArguments, extraEnvironmentVariables []string) (filepath string, err error)

EnableChromeTesting calls SessionManager.EnableChromeTesting D-Bus method.

func (*SessionManager) EnableChromeTestingAndWait

func (m *SessionManager) EnableChromeTestingAndWait(ctx context.Context, forceRelaunch bool,
	extraArguments, extraEnvironmentVariables []string) (filepath string, err error)

EnableChromeTestingAndWait calls EnableChromeTesting and waits for the new chrome process to start up.

func (*SessionManager) GetArcStartTimeTicks

func (m *SessionManager) GetArcStartTimeTicks(ctx context.Context) (time.Time, error)

GetArcStartTimeTicks calls SessionManager.GetArcStartTimeTicks D-Bus method.

func (*SessionManager) HandleSupervisedUserCreationFinished

func (m *SessionManager) HandleSupervisedUserCreationFinished(
	ctx context.Context) error

HandleSupervisedUserCreationFinished calls SessionManager.HandleSupervisedUserCreationFinished D-Bus method.

func (*SessionManager) HandleSupervisedUserCreationStarting

func (m *SessionManager) HandleSupervisedUserCreationStarting(
	ctx context.Context) error

HandleSupervisedUserCreationStarting calls SessionManager.HandleSupervisedUserCreationStarting D-Bus method.

func (*SessionManager) IsScreenLocked

func (m *SessionManager) IsScreenLocked(ctx context.Context) (screenLocked bool, err error)

IsScreenLocked calls SessionManager.IsScreenLocked D-Bus method.

func (*SessionManager) LockScreen

func (m *SessionManager) LockScreen(ctx context.Context) error

LockScreen calls SessionManager.LockScreen D-Bus method.

func (*SessionManager) RetrieveActiveSessions

func (m *SessionManager) RetrieveActiveSessions(ctx context.Context) (map[string]string, error)

RetrieveActiveSessions calls SessionManager.RetrieveActiveSessions D-Bus method.

func (*SessionManager) RetrievePolicyEx

RetrievePolicyEx calls SessionManager.RetrievePolicyEx D-Bus method.

func (*SessionManager) RetrievePrimarySession

func (m *SessionManager) RetrievePrimarySession(ctx context.Context) (username, hash string, err error)

RetrievePrimarySession calls SessionManager.RetrievePrimarySession D-Bus method.

func (*SessionManager) RetrieveSessionState

func (m *SessionManager) RetrieveSessionState(ctx context.Context) (string, error)

RetrieveSessionState calls SessionManager.RetrieveSessionState D-Bus method.

func (*SessionManager) StartSession

func (m *SessionManager) StartSession(ctx context.Context, accountID, uniqueIdentifier string) error

StartSession calls SessionManager.StartSession D-Bus method.

func (*SessionManager) StorePolicyEx

StorePolicyEx calls SessionManager.StorePolicyEx D-Bus method.

func (*SessionManager) WatchPropertyChangeComplete

func (m *SessionManager) WatchPropertyChangeComplete(ctx context.Context) (*dbusutil.SignalWatcher, error)

WatchPropertyChangeComplete returns a SignalWatcher to observe "PropertyChangeComplete" signal.

func (*SessionManager) WatchScreenIsLocked

func (m *SessionManager) WatchScreenIsLocked(ctx context.Context) (*dbusutil.SignalWatcher, error)

WatchScreenIsLocked returns a SignalWatcher to observe the "ScreenIsLocked" signal.

func (*SessionManager) WatchScreenIsUnlocked

func (m *SessionManager) WatchScreenIsUnlocked(ctx context.Context) (*dbusutil.SignalWatcher, error)

WatchScreenIsUnlocked returns a SignalWatcher to observe the "ScreenIsUnlocked" signal.

func (*SessionManager) WatchSessionStateChanged

func (m *SessionManager) WatchSessionStateChanged(ctx context.Context, state string) (*dbusutil.SignalWatcher, error)

WatchSessionStateChanged returns a SignalWatcher to observe "SessionStateChanged" signal for the given state. If state is empty, it matches with any "SessionStateChanged" signals.

func (*SessionManager) WatchSetOwnerKeyComplete

func (m *SessionManager) WatchSetOwnerKeyComplete(ctx context.Context) (*dbusutil.SignalWatcher, error)

WatchSetOwnerKeyComplete returns a SignalWatcher to observe "SetOwnerKeyComplete" signal.

Directories

Path Synopsis
Package ownership provides utilities to run ownership API related tests.
Package ownership provides utilities to run ownership API related tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL