msidal

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 9 Imported by: 0

README

msidal

Microsoft Identity Authentication Library For Go

Installation

Install the package with the following command.

go get github.com/alexandervantrijffel/msidal
Usage

Example calling code for verifying an MSAL based JWT bearer token. This verifies the audience, signature and expiration validity of the token.

import (
    "github.com/alexandervantrijffel/msidal"
)

settings := AzureSettings{
  TenantID:                "Directory (tenant) ID",
  ClientID:                "Application (client) ID",
  ActiveDirectoryEndpoint: "https://login.microsoftonline.com/",
}
token, err := msidal.VerifyToken(&settings, "Bearer ey......")

Example for parsing claims from the returned oidc Token:

var claims struct {
  Name     string   `json:"name"`
  UserName string   `json:"preferred_username"`
}
token.Claims(&claims)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyToken

func VerifyToken(settings *AzureSettings, rawIDToken string) (*oidc.IDToken, error)

Types

type AzureSettings

type AzureSettings struct {
	TenantID                string
	ClientID                string
	ActiveDirectoryEndpoint string
}

Jump to

Keyboard shortcuts

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