我正在使用keycloak来保护我的rest服务。我指的是给定的教程。我创建了rest和前端。现在,当我在后端添加keycloak时,当我的前端进行api调用时,我得到CORS错误。
spring boot中的Application.java文件如下所示
@SpringBootApplication
public class Application
{
public static void main( String[] args )
{
SpringApplication.run(Application.class, args);
}
@Be
var loadData = function () {
var url = 'http://localhost:3000/users';
var req = new XMLHttpRequest();
req.open('GET', url, true);
req.setRequestHeader('Accept', 'application/json');
req.setRequestHeader('Authorization', 'Bearer ' + keycloak.token);
尝试使用以下代码创建新用户:
Keycloak kc = Keycloak.getInstance(
"http://192.168.11.55:8080/auth",
"master", // the realm to log in to
"admin", "pass", // the user
"security-admin-console");
CredentialRepresentation credential = new CredentialRepresentation();
credential
我有这个错误
java.lang.LinkageError: ClassCastException: attempting to tomcat-debug-eclispe/wtpwebapps/xwiki-debug-eclipse/WEB-INF/lib/jsr311-api-1.1.1.jar!/javax/ws/rs/ext/RuntimeDelegate.class to tomcat-debug-eclispe/lib/jboss-jaxrs-api_2.0_spec-1.0.1.Final.jar!/javax/ws/rs/ext/RuntimeDelegate.class
我正在
我正在使用Keycloak REST Api来获得用户的查询param
Get users Returns a list of users, filtered according to query parameters
GET /{realm}/users
对于查询param ?username=admin,但是对于这个查询param值,我也得到了类似的结果,比如awadmin用户名等等。