我使用标准的基于Wildfly的Keycloak适配器使用Keycloak获得了企业应用程序.我面临的问题是,其他Web服务在调用时需要知道当前登录的用户名.如何从Keycloak获取登录的用户信息?
我试着用SecurityContext,WebListener等等,但他们都不是能够给我所需的详细信息.
当试图使用ionic和gradle创建一个android apk文件时,我收到一个错误
FAILURE: Build failed with an exception.
* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2
.2.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the …Run Code Online (Sandbox Code Playgroud) 我有一个基于Spring Security OAuth2的RESTful应用程序.我一直在尝试将默认的Spring Security消息格式从XML更改为JSON,并且已经部分成功.
例如 - 我想出了当请求不包含Bearer令牌时如何更改响应格式(以下行)
<bean id="oauthAuthenticationEntryPoint" class ="c.s.m.security.CustomAuthenticationEntryPoint" />
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何捕获/更改以下两项的格式.
当在安全URL中传递无效令牌时,Spring Security当前会返回.我在哪里更改此格式?
{"error": "invalid_token","error_description": "Invalid access token: 144285e3-9563-420e-8ce"}
Run Code Online (Sandbox Code Playgroud)如何更改BadCredentialsException JSON格式?目前它返回类似于上面的JSON?
下面是我的applicationContext.xml
<sec:http pattern="/oauth/token" create-session="stateless"
use-expressions="true" authentication-manager-ref="authenticationManager">
<sec:csrf disabled="true" />
<sec:anonymous enabled="false" />
<sec:http-basic entry-point-ref="clientAuthenticationEntryPoint" />
<sec:custom-filter ref="clientCredentialsTokenEndpointFilter" before="BASIC_AUTH_FILTER" />
<sec:access-denied-handler ref="oauthAccessDeniedHandler" />
</sec:http>
<sec:authentication-manager alias="authenticationManager"
erase-credentials="false">
<sec:authentication-provider user-service-ref="clientDetailsUserService" />
</sec:authentication-manager>
<bean id="clientDetailsUserService" class="org.springframework.security.oauth2.provider.client.ClientDetailsUserDetailsService">
<constructor-arg ref="clientDetails" />
</bean>
<!-- Entry point - Entry point Filter for token server -->
<bean id="clientAuthenticationEntryPoint" class="org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint">
<property name="realmName" value="Oauth 2 security" /> …Run Code Online (Sandbox Code Playgroud) 我创建一个移动应用程序,这将跟我的REST Web服务,为login,GET,POST,DELETE和logout。我一直在尝试弄清楚如何使用 Keycloak 来保护这些 REST Web 服务。我不想在移动应用程序上使用任何浏览器登录,因此我倾向于使用 Direct Grant API 和 Admin REST API 进行身份验证和令牌验证。但是,现在在查看 Keycloak 上的可用选项后,必须拦截来自移动应用程序的每个请求,然后对 Keycloak 模块进行 REST 调用以验证令牌,然后将响应返回给移动应用程序。
有没有更好的方法来做到这一点?一些内置函数调用来检查令牌有效性,而不是为来自移动应用程序的每个请求进行 HTTP 调用?我认为这是一个巨大的开销。
我的服务器在 JBOSS 上。Spring、Resteasy 和 Keycloak-services 正在被用来找出解决这个问题的方法。