Main Content

prodserver.addon.accessTokenPolicy

Set access token policy for user authorization

    Description

    example

    prodserver.addon.accessTokenPolicy(host,port,token,Name,Value) sets the Azure® Active Directory (Azure AD) credentials for user authorization using one or more name-value arguments and sets a token generation policy to authorize a user that is using MATLAB® Production Server™ add-ons to communicate with a server running at host:port.

    This function requires MATLAB Client for MATLAB Production Server.

    example

    prodserver.addon.accessTokenPolicy(host,port,token) sets a token generation policy or sets the value of a bearer token to authorize a user that is using MATLAB Production Server add-ons to communicate with a server running at host:port.

    Examples

    collapse all

    To use a system-generated bearer token, you must set the Azure AD app registration credentials using name-value arguments.

    First, make sure that access control is enabled on the server. For more information, see Application Access Control.

    Make sure that the MATLAB Production Server add-on of the deployed application is installed on the client machine. For more information about installing add-ons, see Execute Deployed MATLAB Functions.

    Set the system to automatically generate the bearer token to use in requests to a server running at localhost and port 57142, and also specify Azure AD app registration credentials for user authorization.

    prodserver.addon.accessTokenPolicy('localhost',57142,'automatic',...
    'ClientID','0d912326-e439-41d0-822c-b15asdf6137c3',...
    'ServerID','dwe4581bf-7867-4b90-a05a-16be6a82flkh',...
    'IssuerURI','https://login.microsoftonline.com/yourcompany.com')

    Typically, you set the Azure AD app registration credentials once per server instance.

    Specify a bearer token to use when communicating with a server.

    First, enable access control on the server. For more information, see Application Access Control.

    Make sure that the MATLAB Production Server add-on of the deployed application is installed on the client machine. For more information about installing add-ons, see Execute Deployed MATLAB Functions.

    Specify the bearer token 'bearer_token_value' to use in requests to a server running at IP address 10.2.2.5 and port 57142.

    prodserver.addon.accessTokenPolicy('10.2.2.5',57142,'bearer_token_value')

    Specify that no bearer token is required when access control is not enabled on a server.

    Make sure that the MATLAB Production Server add-on of the deployed application is installed on the client machine. For more information about installing add-ons, see Execute Deployed MATLAB Functions.

    Set the system to not generate a bearer token to use in requests to a server running at IP address 10.2.2.5 and port 57142.

    prodserver.addon.accessTokenPolicy('10.2.2.5',57142,'none')

    Input Arguments

    collapse all

    Host name of the server hosting a deployable archive from which the add-on is installed, specified as a character vector or string scalar.

    Example: '144.213.5.7'

    Data Types: char | string

    Port number of the server hosting a deployable archive from which the add-on is installed, specified as a positive scalar.

    Example: 9920

    Data Types: uint8 | uint16

    Access token policy, specified as a character vector or string scalar. Set a token generation policy or specify a bearer token to authorize a user when communicating with a server. Possible options follow:

    • 'automatic' — Generate bearer tokens using user credentials of the user logged in to the client machine. Azure AD app registration credentials must be set to use this policy.

    • 'none' — Do not generate an access token. This value is the default.

    • Character vector or string scalar — Specify a value to use as the bearer token.

    If access control is enabled on the server, you must set the policy to 'automatic' or specify a bearer token.

    Example: 'automatic'

    Example: 'none'

    Example: 'AAAAAAAAAABBBBAAAAAAAMLheAAAAAAA0%2BuSepl%2BULvsea4JtiGRiSDSJSI%3DEUifiRmndf5E2XzMDjRfl76ZC9Ub0wnz4XsNiRVBChTYbJcE3F'

    Data Types: char | string

    Name-Value Pair Arguments

    Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

    Example: 'ClientID','d17lk1bf-7977-4c90-a95a-16by7982fbaf', 'ServerID', 'd7pj91bf-7977-4b90-a05a-17vy5s82fbaf','IssuerURI','https://login.microsoftonline.com/your_organization_tenantID'

    Application ID of the client app registered in Azure AD used for user authorization, specified as a character vector or string scalar.

    Example: 'ClientID','d17lk1bf-7977-4c90-a95a-16by7982fbaf'

    Data Types: char | string

    Application ID of the server app registered in Azure AD used for user authorization, specified as a character vector or string scalar.

    Example: 'ServerID','d7pj91bf-7977-4b90-a05a-17vy5s82fbaf'

    Data Types: char | string

    URI to generate a bearer token, specified as a character vector or string scalar. For Azure AD, the IssuerURI is https://login.microsoftonline.com/ followed by the Azure AD tenant ID.

    Example: 'IssuerURI','https://login.microsoftonline.com/your_organization_tenantID'

    Data Types: char | string

    Introduced in R2020b