sso-mib 0.6.0
Library to interact with the Microsoft Device Broker for SSO
Loading...
Searching...
No Matches
sso-mib

API Docs

Single-Sign-On using Microsoft Identity Broker (SSO-MIB)

This project implements a C library to interact with a locally running microsoft-identity-broker to get various authentication tokens via DBus. By that, it implements support for the OIDC extension [MS-OAPXBC], sections 3.1.5.1.2 Request for Primary Refresh Token, 3.1.5.1.3 Exchange Primary Refresh Token for Access Token and can be used to obtain Proof-of-Possession tokens for RDP [MS-RDPBCGR].

Dependencies

  • Gio2.0
  • JSON-Glib
  • libdbus
  • libuuid

Interface

The interface of the library is defined in <sso-mib/sso-mib.h>. Only this file must be included. The semantics follow roughly the MSAL Python library.

Logging

We integrate with the GLib message logging system and use the domain ssomib. To debug the input and output parameters of the DBus calls, set the environment variable G_MESSAGES_DEBUG=ssomib.

We try to keep the interface both API and ABI compatible, however this is not guaranteed prior to version 1.0.

How do I use this library

Note: for simplicity, this code does not have error handling and cleanup logic.

#include <sso-mib/sso-mib.h>
const gchar* client_id = "<my-client-uuid>";
const gchar* authority = MIB_AUTHORITY_COMMON;
MIBClientApp *app = mib_public_client_app_new(client_id, authority, NULL, NULL);
GSList *scopes = NULL;
scopes = g_slist_append(scopes, g_strdup(MIB_SCOPE_GRAPH_DEFAULT));
MIBPrt *prt = mib_client_app_acquire_token_silent(app, account, scopes, NULL, NULL, NULL);
MIBPrtSsoCookie *prt_cookie =
const char * name = mib_prt_sso_cookie_get_name(cookie);
const char * value = mib_prt_sso_cookie_get_content(cookie);
void * MIBAccount
Definition mib-account.h:30
MIBPrtSsoCookie * mib_client_app_acquire_prt_sso_cookie(MIBClientApp *app, MIBAccount *account, const gchar *sso_url, GSList *scopes)
Acquire a PRT SSO cookie.
MIBAccount * mib_client_app_get_account_by_upn(MIBClientApp *app, const gchar *upn)
Filter the registered accounts by UPN and return the first match.
void * MIBClientApp
Definition mib-client-app.h:57
MIBPrt * mib_client_app_acquire_token_silent(MIBClientApp *app, MIBAccount *account, GSList *scopes, const gchar *claims_challenge, MIBPopParams *auth_scheme, const gchar *id_token)
Acquire a token without user interaction.
#define MIB_SCOPE_GRAPH_DEFAULT
Default scope for graph API.
Definition mib-client-app.h:41
MIBClientApp * mib_public_client_app_new(const gchar *client_id, const gchar *authority, GCancellable *cancellable, GError **error)
Start a new session.
#define MIB_AUTHORITY_COMMON
Common authority for all tenants.
Definition mib-client-app.h:31
#define MIB_SSO_URL_DEFAULT
Default SSO URL.
Definition mib-client-app.h:36
void * MIBPrt
Definition mib-prt.h:31
const gchar * mib_prt_sso_cookie_get_content(MIBPrtSsoCookie *self)
void * MIBPrtSsoCookie
Definition mib-prt-sso-cookie.h:31
const gchar * mib_prt_sso_cookie_get_name(MIBPrtSsoCookie *self)

Further examples are provided in examples.

Frontend

The sso-mib-tool provides a simple frontend to interact with the library.

Maintainers

Code Integrity

Since version v0.5, git release tags are signed with one of the following maintainer GPG keys:

  • AF73F6EF5A53CFE304569F50E648A311F67A50FC (Felix Moessbauer)

License

The library is licensed according to the terms of the GNU Lesser General Public License v2.1. The tooling is licensed according to the terms of the GNU Public License v2.0. The examples are licensed according to the terms of the MIT License.