C# Class Microsoft.Legal.MatterCenter.Utility.SPOAuthorization

This class is used for reading authorization token which has been sent by the client.This class will validate the client token, get the token for the service from Azure Active Directory and pass the service token to sharepoint
Inheritance: ISPOAuthorization
显示文件 Open project: Microsoft/mattercenter

Private Properties

Property Type Description
GetAccessToken Task
GetAccessTokenForGraph Task
GetClientContextWithAccessToken ClientContext

Public Methods

Method Description
GetClientContext ( string url ) : ClientContext

This method will get the access token for the service and creats SharePoint ClientContext object and returns that object

GetGraphAccessToken ( ) : string

This method will get the access token for the Microsoft Graph and returns that token

SPOAuthorization ( IOptions generalSettings, IOptions errorSettings, IOptions logTables, ICustomLogger customLogger, IHttpContextAccessor httpContextAccessor ) : System

Constructor where GeneralSettings and ErrorSettings are injected

Private Methods

Method Description
GetAccessToken ( ) : Task

This method will get access for the web api from the Azure Active Directory. This method internally uses the Authorization token sent by the UI application

GetAccessTokenForGraph ( ) : Task

This method will get access for the web api from the Azure Active Directory. This method internally uses the Authorization token sent by the UI application

GetClientContextWithAccessToken ( string targetUrl, string accessToken ) : ClientContext

Uses the specified access token to create a client context. For each and every request to SPO an authorization header will be sent. With out authorization header, SPO will reject the request

Method Details

GetClientContext() public method

This method will get the access token for the service and creats SharePoint ClientContext object and returns that object
public GetClientContext ( string url ) : ClientContext
url string The SharePoint Url for which the client context needs to be creatwed
return ClientContext

GetGraphAccessToken() public method

This method will get the access token for the Microsoft Graph and returns that token
public GetGraphAccessToken ( ) : string
return string

SPOAuthorization() public method

Constructor where GeneralSettings and ErrorSettings are injected
public SPOAuthorization ( IOptions generalSettings, IOptions errorSettings, IOptions logTables, ICustomLogger customLogger, IHttpContextAccessor httpContextAccessor ) : System
generalSettings IOptions
errorSettings IOptions
logTables IOptions
customLogger ICustomLogger
httpContextAccessor IHttpContextAccessor
return System