Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Child pages
  • OAuth2 Module - Run module with LegacyUI only

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In the current state, OAuth2 module is purely REST based.

To enable UI features such as Admin dashboard, Client registration form, etc. implement the following things : 

Add dependency for Legacy UI module in /omod/src/main/java/resources/config.xml file

Code Block
languagexml
titleconfig.xml
<aware_of_modules>
	<aware_of_module>org.openmrs.module.legacyui</aware_of_module>
</aware_of_modules>

<extension>
        <point>org.openmrs.admin.list</point>
        <class>${project.parent.groupId}.${project.parent.artifactId}.extension.html.AdminList</class>
</extension>

 

Also, create the following class to support XML changes

Code Block
languagejava
/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.oauth2.extension.html;

import org.openmrs.module.Extension;
import org.openmrs.module.web.extension.AdministrationSectionExt;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This class defines the links that will appear on the administration page under the
 * "oauth2.title" heading.
 */
public class AdminList extends AdministrationSectionExt {

	/**
	 * @see AdministrationSectionExt#getMediaType()
	 */
	public Extension.MEDIA_TYPE getMediaType() {
		return Extension.MEDIA_TYPE.html;
	}

	/**
	 * @see AdministrationSectionExt#getTitle()
	 */
	public String getTitle() {
		return "oauth2.title";
	}

	/**
	 * @see AdministrationSectionExt#getLinks()
	 */
	public Map<String, String> getLinks() {
		LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
		map.put("module/oauth2/registeredClient/index.htm", "oauth2.manage.registered");
		return map;
	}

}

 

All other UI functionality exists in the module (smile)