Custom mediator

An OAuth 2.0 mediator is used as a callback during the OAuth 2.0 message processing to perform customized post processing.


Write an OAuth20 mediator

To write a mediator, implement the interface...

We can implement one or more mediate* methods to perform custom post processing.

Method called by a factory when an instance of this object is created.

Method called by the core component after basic message validation and processing to allow any post custom processing by the component consumer in the processAuthorization method.

Method called by the core component when the protocol exception happens to allow any post custom processing by the component consumer in the processAuthorization method.

Method called by the core component after basic message validation and processing to allow any post custom processing by the component consumer in the processResourceRequest method.

Method called by the core component when protocol exception happens to allow any post custom processing by the component consumer in the processResourceRequest method.

Method called by the core component after basic message validation and processing to allow any post custom processing by the component consumer in the processTokenRequest method.

Method called by the core component when protocol exception happens to allow any post custom processing by the component consumer in the processTokenRequest method.


Enable OAuth20 mediator for an OAuth provider

To add a customized mediator to a specific OAuth20 service provider, update the configuration file for the service provider, for example, OAuthConfigSample.xml. Locate the oauth20.mediator.classnames parameter and add the class name for the mediators. We can also specify multiple class names for mediators for the oauth20.mediator.classnames parameters. If multiple mediators are specified, those mediators are started in the order they are specified in the parameter. The following example shows a sample custom mediator entry in the provider configuration file:

The following code sample implements the credential validation using WebSphere Application Server user registry in the resource owner password credentials flow.

Parent