Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upgrade the privilege of rest Interface

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "how to upgrade the permissions of the rest interface", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to upgrade the permissions of the rest interface.

Brief introduction

In addition to using the system's default interface authentication, Rest service processing allows permissions to be refined into each application, that is, each application can customize the interfaces it exposes to the outside world.

prerequisite

Platform: LinkeyBPM (Application process Development platform)

Version: 129.5 or integrate the latest Rest interface service

Create an interface authentication rule

Publish authentication interface

Suppose the published interface id is: getLoginToken, and the interface url address is: / rest/ws/g/AABBCCDD/getLoginToken

Application configuration authentication interface

The only id of the application configuration is tokenUrlId, and the configuration value is the publishing API getLoginToken.

Package cn.linkey.itemp;//package cn.linkey.rulelib.AABBCCDD;import java.util.Date;import java.util.HashMap;import cn.linkey.factory.BeanCtx;import cn.linkey.rest.RestUtil;import cn.linkey.rule.LinkeyRule;import cn.linkey.util.Tools / * * @ RuleName: used for API authentication * @ author admin * @ Created: 2019-11-05 16:54:01 * / final public class R_AABBCCDD_B001 implements LinkeyRule {@ Override public String run (HashMap params) throws Exception {/ / params is the parameter / / String userid = BeanCtx.getRequest (). GetHeader ("userId") passed when running this rule. String userId = BeanCtx.g ("userId"); String password = BeanCtx.g ("password"); String jsonStr = ""; BeanCtx.out ("token for custom application authentication") If (RestUtil.checkuserpwd (userId, password)) {jsonStr = "{\" token\ ":\" + Tools.base64 (userId + "#" + new Date (). GetTime ()) + "\"} "; jsonStr = RestUtil.returnLinkeyData (" 1 "," Application Certification Test ", jsonStr) } else {jsonStr = RestUtil.returnLinkeyData ("0", "wrong username or password", jsonStr);} return jsonStr;}} effect test

At this point, I believe you have a deeper understanding of "how to upgrade the rest interface permissions". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report