Microsoft Authentication Library (MSAL) plugin

Microsoft Authentication Library (MSAL) plugin

This plugin is a wrapper for the Microsoft Authentication Library (MSAL) for Go library. It supports fetching OAuth2 access tokens for users in Office 365.

Configuration

For the configuration schema, see msal.schema.json. Below is a sample configuration.

smtpd.yaml

plugins:
  - id: msal
    path: /opt/halon/plugins/msal.so
    config:
      tenants:
        - id: tenant1
          client_id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
          authority: https://login.microsoftonline.com/organizations
          scopes:
            - https://outlook.office.com/SMTP.Send
          cache_file: /tmp/msal_tenant1_cache.json

Exported functions

msal(options)

Fetch an OAuth2 access token using the provided credentials. A successful fetch will return an associative array with a result key that contains the access token. On error an associative array with a error key will be provided.

Example

Below is an example on how to send email through Office 365 using OAuth2.

predelivery.hsl

$tenant = "tenant1";
$username = "[email protected]";
$password = "xxxxxxxx";

$result = msal(["id" => $tenant, "username" => $username, "password" => $password]);

if (!$result["result"]) {
    Queue([
        "reason" => "Could not fetch access token",
        "increment_retry" => false,
        "delay" => 60
    ]);
}

$password = "user=".$username."\x01auth=Bearer ".$result["result"]."\x01\x01";

Try([
    "server" => "smtp.office365.com",
    "port" => 587,
    "saslmechanism" => "XOAUTH2",
    "saslpassword" => $password
]);
Owner
Halon Extras
HSL modules and native plugins
Halon Extras
Similar Resources

Chacha20 with blake2s providing authentication

chacha20blake2s A small construction of chacha20 with blake2s as the HMAC. This

Jan 3, 2022

Go Http Proxy with Authentication, Schedule Control, and Portal Control

goproxy Go Http Proxy with Authentication, Schedule Control, and Portal Control Why this tool? You may need to restrict my kids's youtube watch time i

Mar 27, 2022

A Go library for connecting to HandlerSocket (github.com/ahiguti/HandlerSocket-Plugin-for-MySQL)

handlersocket-go Go library for connecting to HandlerSocket Mysql plugin. See github.com/ahiguti/HandlerSocket-Plugin-for-MySQL/ Installation $ go get

Jan 19, 2021

Yet another SIP003 plugin for shadowsocks, based on Xray-core

Yet another SIP003 plugin for shadowsocks, based on Xray-core Build go build Usage See command line args for advanced usages.

Jan 8, 2023

DipDup plugin for selective metadata indexing

DipDup metadata indexer DipDup service for indexing contract and token metadata. Based on TzKT indexer. For start synchronization of DipDup state TzKT

Nov 25, 2022

Tool for monitoring network devices (mainly using SNMP) - monitoring check plugin

Tool for monitoring network devices (mainly using SNMP) - monitoring check plugin

Thola Description A tool for monitoring network devices written in Go. It features a check mode which complies with the monitoring plugins development

Dec 29, 2022

Protoc plugin to generate contract tests for gRPC in Go

Deal - Go Introduction WE DO NOT SUPPORT THE SERVER SIDE YET This plugin allows us to write Consumer-Driver Contracts tests! Usage example Proto servi

Sep 3, 2022

This plugin allows you to start a local server with hot reloading with Esbuild

esbuild-dev-server This plugin allows you to start a local server with hot reloading with Esbuild Installation npm npm i esbuild-dev-server -D yarn y

Nov 4, 2022

A Caddy v2 plugin to track requests in Pirsch analytics

caddy-pirsch-plugin A Caddy v2 plugin to track requests in Pirsch Analytics. Usage pirsch [matcher] { client_id pirsch-client-id client_se

Sep 15, 2022
Related tags
The plugin serves as a starting point for writing a Mattermost plugin

Plugin Starter Template This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository.

Dec 10, 2021
Feb 10, 2022
Cf-cli-find-app-plugin - CF CLI plugin to find applications containing a search string

Overview This cf cli plugin allows users to search for application names that co

Jan 3, 2022
Twitter-plugin - Falco Plugin for Twitter Stream

Twitter Plugin This repository contains the twittter plugin for Falco, which fol

Mar 17, 2022
connect to microsoft flight simulator 2020 using golang

msfs2020-go simconnect package msfs2020-go/simconnect connects to microsoft flight simulator 2020 using golang. cross-compiles from macos/linux, no ot

Nov 23, 2022
User enumeration with Microsoft Teams API
User enumeration with Microsoft Teams API

UserEnumTeams Description Sometimes user enumeration could be sometimes useful during the reconnaissance of an assessment. This tool will determine if

Jan 2, 2023
Bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API
Bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)

Jan 4, 2023
Downloads the Windows 10 wallpapers provided by Microsoft.

microsoft-wallpapers Preparation Prepare an input file that contains a list of links from the Microsoft website that lead to wallpapers. This list is

Nov 29, 2021
A http proxy server chaining a upstream which needs authentication headers.

Normalize HTTP Proxy A http proxy server chaining a upstream which needs authentication headers. local -> [np] -> upstream -> destination Usage Norma

Dec 14, 2022
Protect any Kubernetes application with Azure Active Directory authentication
Protect any Kubernetes application with Azure Active Directory authentication

Azure Active Directory Proxy Covers any app with active directory authentication How does it work You gonna need to register an app in your Azure Acti

Jan 25, 2022