约束编程(CP)和线性规划(LP)或混合整数规划(MIP)之间有什么区别?我知道什么是LP和MIP,但不明白与CP的区别 - 或者CP与MIP和LP相同?我对此很困惑......
linear-programming constraint-programming mixed-integer-programming
我有一个带有 javascript 的 html 页面,我想在其中自动登录用户。我有以下代码:
var url = "http://localhost:8180/auth/realms/Myrealm/protocol/openid-connect/token";
const response = await fetch(url, {
mode: 'no-cors',
method: "POST",
body: JSON.stringify({
"client_id":"myclientid",
"username":"admin",
"password":"123",
"grant_type":"password"
}),
headers:{
//"Content-type":"application/x-www-form-urlencoded",
"Content-Type": "application/json"
}
})
Run Code Online (Sandbox Code Playgroud)
在 keycloak 服务器上我添加了Web Origins '*'。我收到以下错误:
POST http://localhost:8180/auth/realms/Myrealm/protocol/openid-connect/token 400(错误请求)
我不知道为什么它不起作用。当我使用终端时,它工作正常:
curl -i -d "client_id=myclientid" -d "username=admin" -d "password=123" -d "grant_type=password" http://localhost:8180/auth/realms/Myrealm/protocol/openid-connect/token
Run Code Online (Sandbox Code Playgroud)
(钥匙斗篷版本4.8.3)
const response = await fetch(url, {
method: "POST",
body: 'client_id=myclientid&password=123&username=admin&grant_type=password',
headers:{
"Content-type":"application/x-www-form-urlencoded"
}
})
Run Code Online (Sandbox Code Playgroud)
我得到以下回复:
我按照演练为 keycloak(版本 4.8.3)设置自定义身份验证器 spi。我几乎只使用从这里获得的示例代码。我只更改了,pom以便我可以编译项目并使用mvn clean install wildfly:deploy. 它有效......我可以在 keycloak 中配置新的身份验证流程,更新浏览器流程并设置所需的操作。但如果我想在我的应用程序中使用新的身份验证,我会收到以下消息:Invalid username or password。在控制台中我得到以下输出:
17:12:20,721 WARN [org.keycloak.events] (default task-1) type=REFRESH_TOKEN_ERROR, realmId=master, clientId=security-admin-console, userId=null, ipAddress=127.0.0.1, error=invalid_token, grant_type=refresh_token, client_auth_method=client-secret\n17:13:50,514 WARN [org.keycloak.services] (default task-4) KC-SERVICES0013: Failed authentication: org.keycloak.authentication.AuthenticationFlowException: authenticator: secret-question-authenticator\n at org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:194)\n at org.keycloak.authentication.AuthenticationProcessor.authenticateOnly(AuthenticationProcessor.java:910)\n at org.keycloak.authentication.AuthenticationProcessor.authenticate(AuthenticationProcessor.java:779)\n at org.keycloak.protocol.AuthorizationEndpointBase.handleBrowserAuthenticationRequest(AuthorizationEndpointBase.java:139)\n at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildAuthorizationCodeAuthorizationResponse(AuthorizationEndpoint.java:419)\n at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.process(AuthorizationEndpoint.java:152)\n at org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint.buildGet(AuthorizationEndpoint.java:108)\n at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n at java.lang.reflect.Method.invoke(Method.java:498)\n at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)\n at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:509)\n at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:399)\n at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:363)\n at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)\n …Run Code Online (Sandbox Code Playgroud)