最近我将Spring配置从XML迁移到Java配置.它是一个Spring OAuth 2服务器,一些端点受到客户端身份验证的保护,一些端点(confirm_access)受到用户身份验证的保护,用户身份验证通过过滤器("authenticationFilter")进行重定向委托给登录应用程序.但是我无法对Spring Security Java配置做同样的事情:
这是我工作的安全XML配置:
<sec:http pattern="/token" create-session="stateless" authentication-manager-ref="clientAuthenticationManager"
entry-point-ref="oauthAuthenticationEntryPoint">
<sec:intercept-url pattern="/token" access="IS_AUTHENTICATED_FULLY" />
<sec:anonymous enabled="false" />
<sec:http-basic entry-point-ref="oauthAuthenticationEntryPoint" />
<!-- include this only if you need to authenticate clients via request parameters -->
<sec:custom-filter ref="clientCredentialsTokenEndpointFilter" before="BASIC_AUTH_FILTER" />
<sec:access-denied-handler ref="oauthAccessDeniedHandler" />
</sec:http>
<sec:http pattern="/css/**" security="none" />
<sec:http pattern="/js/**" security="none" />
<sec:http access-denied-page="/errors/access-denied.html" disable-url-rewriting="true" entry-point-ref="authenticationEntryPoint">
<sec:intercept-url pattern="/authorize" access="ROLE_USER" />
<sec:intercept-url pattern="confirm_access" access="ROLE_USER" />
<sec:intercept-url pattern="/device/authorize" access="ROLE_USER" />
<sec:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<sec:custom-filter ref="authenticationFilter" before="ANONYMOUS_FILTER" />
<sec:anonymous />
</sec:http>
<sec:authentication-manager id="clientAuthenticationManager"> …Run Code Online (Sandbox Code Playgroud) 我需要为JS应用程序中的同一域中的所有用户创建一个文件并共享它.
这是创建请求主体:
{title: documentName, mimeType: "application/vnd.google-apps.spreadsheet"}
比我添加创建文件的域权限.
权限'插入请求正文:
{ "role": "writer","type": "domain","value": domain}
对于创建文件的用户,一切正常,我可以找到该文件{q:"title='"+documentName+"' and trashed=false"}.
但我找不到该文件与其他用户.
我试着查看sharedWithMe文件夹:
{q:"title='"+that._documentName+"' and trashed=false and sharedWithMe=true"} - 没有结果
但我source:domain在Drive API中找不到任何相关内容.