Identify and authorize
Use the Identify and authorize policy to identify and validate the authorization of the applications to access the APIs.
On applying this policy, the applications are identified by using a set of identification types that are listed in the specifications table. The application is identified and authorized based on the application lookup condition.
The following application lookup conditions are supported:
- Registered applications. Identifies the application and validates the identified application against the registered applications. On successful validation, it allows access to the API. The applications that are associated with the API are called as registered application.
- Global applications. Identifies the application and validates the identified application against the global applications. On successful validation, it allows access to the API. All the active applications that are available are called as global application.
In IBM API Studio, this policy
is identified by the kind IAM.
Example of an Identify and authorize policy in code view.
kind: IAM
apiVersion: api.ibm.com/v1
metadata:
name: "sample-IAM"
version: 1.0
namespace: sample
spec:
accessControl:
- - httpBasic:
applicationSecurity:
mode: authorize #possible values: identify, authenticate
credentialLocation: #optional
httpHeader:
name: my-custom-header
credentialRegistry: #Required
- primary-ldap
- secondary-ldap
userGroupAuthorization: #optional
requiredGroups:
- admins
- rnd
- apiKey:
applicationSecurity: #Required
mode: authorize
credentialLocation:
httpHeader:
name: my-api-key-header
- - oauth:
applicationSecurity:
mode: authorize
credentialLocation: #optional
httpHeader:
name: my-oauth-header
providers: #required
- provider1
- provider2
introspectionCredentials:
idHeader: my-id-header
secretheader: my-secret-header
audClaim: #optional
- aud1
- aud2
requiredScopes:
- provider: provider1
scopes:
- read
- write
- provider: provider2
scopes:
- readwrite
- - jwt:
applicationSecurity:
mode: authorize
credentialLocation: #optional
httpHeader:
name: my-jwt-header
providers:
- provider1
- provider2
requiredClaims:
- provider: provider1
claims: #required
- name: my-claim-1
value: my-value1
- name: my-claim-2
value: my-value2
- - hostname:
applicationSecurity: #Required
mode: authorize
- - ipAddress:
applicationSecurity: #Required
mode: authorize
- - certificate:
applicationSecurity: #Required
mode: authorize
credentialLocation:
httpHeader:
name: my-cert-header
- - payloadElement:
name: 'payload_element_1'
- - httpHeaders:
applicationSecurity: #Required
mode: authorize
credentialLocation:
- header1
- header2
extensions:
dp-nano-gateway:
apiVersion: api.ibm.com/v1
spec:
securityNamespace: sec1 #optional
accessControl:
payloadElement:
- name: 'payload_element_1'
applicationSecurity: #Required
mode: authorize
credentialLocation:
regex: my-regex-*expr #or jsonata, only one allowed
webm-gateway:
apiVersion: api.ibm.com/v1
spec:
authenticationMode: 'ANY | ALL'
allowAnonymous: {}
triggerPolicyViolation: true
accessControl:
kerberos:
applicationSecurity:
mode: authorize
servicePrincipleName: ''
servicePrinciplePassword: ''
openIdConnect:
applicationSecurity:
mode: authorize # authorize = registered; authenticate = global; identify = "global and default"
payloadElement:
applicationSecurity: #Required
mode: authorize
payLoadIdentifier:
- jPath: '$.customer.name'
- xpath: '$.customer.name'
namespaces:
- prefix: ''
URI: ''
- regex: '$.customer.name'For the IAM policy kind, configure these specifications:
| Property | Description |
|---|---|
spec |
|