Customized automatic connection


One of the first steps in integrating CMS Ametys is to determine how contributors log in (the authentication process is detailed on the User authentication page).

It's perfectly possible to set up an automatic connection, i.e. one that doesn't require you to enter a login and password, for demonstration purposes for example. In this case, the same identifier is always used, regardless of the user who logs on: we can speak of an anonymous user.

An anonymous connection exists by default in the application (via the org.ametys.runtime.plugins.core.authentication.Defined), but the integrator can create a new extension point to customize the associated login.

The declaration of this extension point must be made in the plugin.xml file of a plugin Ametys . If necessary, you may need to create a new plugin, in which case follow the instructions on the plugin Ametys Architecture page.

Pour avoir un CredentialsProvider qui fonctionne sur ce principe mais pour lequel l'intégrateur souhaite personnaliser l'identifiant, il faut créer un nouveau plugin (en suivant les instructions de la page Création d'un nouveau plugin), et lui spécifier l'extension suivante (personnaliser l'identifiant de l'extension et le <user>) :

Here's an example: any user will be automatically logged in as "user1".

<extension id="org.ametys.myplugin.authentication.MyDefinedAuthentification"
			point="org.ametys.runtime.authentication.CredentialsProvider" 
			class="org.ametys.runtime.plugins.core.authentication.DefinedCredentialsProvider"
			logger="org.ametys.runtime.authentication.defined">
	<!-- This credential provider is an automatic login with the defined user's login -->
    <user>user1</user>
</extension>

Note that you will then need to select this new extension point in the plugins and workspaces tool (described on page Plugins and Workspaces) or directly modify the WEB-INF/param/runtime.xml (see Runtime file.xml) .

<org.ametys.runtime.authentication.CredentialsProvider>org.ametys.myplugin.authentication.MyDefinedAuthentification</org.ametys.runtime.authentication.CredentialsProvider>
 
 
 


Back to top