小编jam*_*mie的帖子

Java LDAP搜索似乎无法处理空间

调用javax.naming.ldap.InitialLdapContext的search()方法时,传入DN ...

OU=User Structure, OU=Acecity(LTO), OU=AceCloud,OU=Hosting, DC=AceCloud,DC=local
Run Code Online (Sandbox Code Playgroud)

输出的错误是 Authentication failed. failed to authenticate user:[LDAP: error code 32 - 0000208D: NameErr: DSID-0315270B, problem 2001 (NO_OBJECT), data 0.

LdapName baseDN = new LdapName(baseDN
NamingEnumeration results = ctx.search(baseDN, "("+ identity.getBindAttribute() + "=" + acctname + ")", sc);
Run Code Online (Sandbox Code Playgroud)

出现问题的原因是空间User Structure.当我将用户放在另一个不包含空格的OU中时,我可以进行身份​​验证.我已经尝试了以下所有方法:

OU=User\ Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local
OU=User\20Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local
OU=User\\20Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local
OU=User%Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local
OU=User\ Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local
OU=User\\ Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local
OU=User\\\\ Structure, OU=Acecity(LTO), OU=AcecityCloud,OU=Hosting, DC=AcecityCloud,DC=local …
Run Code Online (Sandbox Code Playgroud)

java ldap

6
推荐指数
1
解决办法
1500
查看次数

Vaadin Spring-Boot 应用程序在生产模式下作为 JAR 运行时不会渲染 CSS

有什么想法为什么在生产环境中发布新的 Vaadin / Spring-Boot 应用程序时,Vaadin 不会在前端目录中渲染自定义 css,尽管它在调试模式下会渲染?

该应用程序是为生产而构建的,如下所示:

mvn install -Pproduction
Run Code Online (Sandbox Code Playgroud)

然后运行生成的应用程序,如下所示:

java --enable-preview -jar target\app-1.0-SNAPSHOT.jar
Run Code Online (Sandbox Code Playgroud)

通过 JAR 文件方法运行时,CSS 未在浏览器中正确应用。其他一切都很好。

当应用程序运行时如下:

mvn spring-boot:run 
Run Code Online (Sandbox Code Playgroud)

所有页面均正确呈现。CSS 已正确加载。

在LoginView类中,CSS的导入如下:

@CssImport(value = "./views/login/login-view.css", themeFor = "vaadin-login-overlay-wrapper")
Run Code Online (Sandbox Code Playgroud)

login-view.css 文件位于 [项目目录]\frontend\views\login-view.css

当运行 mvn spring-boot:run 时,CSS 文件被正确拾取,但是,当使用 JAR 方法运行时,则不然。我不确定这是否是设计使然,但我没有看到 css 文件存储在生成的 JAR 文件中的任何位置。

为了缓解这种情况,我尝试将前端文件放在 [project dir]\src\main\resources\META-INF\frontend 中,而不是默认位置 [project dir]\frontend 中,因为我在某处读到 CssImport 在 resources\ 内部查找通过 JAR 运行时的 META-INF\frontend 文件夹。当我将文件放在这个位置时,CSS 文件会合并到 JAR 中,并且可以从 http://localhost:8080/frontend/views/login/login-view.css 进行访问,但是可惜 LoginView 页面似乎仍然不存在渲染 CSS。

该应用程序最初是使用 Vaadin 应用程序构建器构建的。pom.xml 与默认的大致相同。我正在运行 Vaadin 19.0.7。提前致谢

vaadin spring-boot vaadin-flow

6
推荐指数
0
解决办法
427
查看次数

Gmail REST API获取邮件功能会返回无效的historyId

好像Gmail REST API中可能存在严重问题.

  1. 调用/ userId/messages以获取消息列表
  2. 对于每个,调用/ userId/messages/id来获取消息
  3. 获取每个消息对象上的最高(或任何)startHistoryId
  4. 然后调用/ userId/history/list传递startHistoryId作为参数

结果出人意料.Gmail REST API返回404 Not Found ..似乎返回的historyId未注册或有效.

在调用/ userId/profile时,startHistoryId有效,可以在/ userId/history/list调用中成功使用.

com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
{
"code" : 404,
"errors" : [ {
     "domain" : "global",
     "message" : "Not Found",
     "reason" : "notFound"
    } ],
  "message" : "Not Found"
}
Run Code Online (Sandbox Code Playgroud)

gmail-api

4
推荐指数
1
解决办法
1788
查看次数

如何在没有用户干预的情况下执行 G Suite 域范围的授权?

我们的应用要求访问与 Gsuite 帐户相关的所有 Gmail 邮箱。我可以按照https://developers.google.com/admin-sdk/reports/v1/guides/delegation 上的说明完成此操作。即手动创建服务帐户密钥,启用全域范围的凭据委托并在 G Suite 管理区域中手动分配适当的权限。当为我们的每个客户手动设置时,这似乎有效,但是,该过程复杂而繁琐,并且是采用的障碍。

为了实现一键式注册过程,根据 G Suite 市场的要求,我创建了一个 OAuth 客户端 ID(而不是服务帐户),并在注册过程中使用此凭据通过同意过程重定向用户。此后,使用刷新/访问凭据访问 G Suite API。这非常有效,除了我只能访问登录用户的邮箱(不能访问域中的其他任何人)。域范围的委派似乎不适用于客户端 ID 凭据。

我确实意识到服务帐户凭据具有客户端 ID,但它们不允许指定可接受的重定向 URI 的能力。因此,使用服务帐户似乎无法实现同意过程。

我的应用已在 Chrome 商店注册。如何创建凭证,使用同意流程接受权限,并且仍然享有域范围委派的好处?

google-api google-apps google-authentication google-workspace

4
推荐指数
1
解决办法
2824
查看次数

使用身份验证范围https://mail.google.com/访问Gmail API时的access_denied

我正在尝试使用Gmail REST API读取/写入Gmail邮箱中的电子邮件/文件夹.添加以下Google身份验证范围时,可以从Gmail REST API中读取电子邮件,而不会出现任何问题:

https://apps-apis.google.com/a/feeds/compliance/audit/, https://www.googleapis.com/auth/admin.directory.user.readonly,https://www.googleapis.com /auth/gmail.readonly, https://www.googleapis.com/auth/admin.directory.group.member.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly

注意:参数https://www.googleapis.com/auth/gmail.readonly正确允许用户从邮箱中读取.

但是,我也需要能够删除电子邮件.因此,根据https://developers.google.com/gmail/api/auth/scopes?hl=ja上的文档,只需要包含https://mail.google.com/代替https: //www.googleapis.com/auth/gmail.readonly.添加以下auth范围时:

https://apps-apis.google.com/a/feeds/compliance/audit/, https://www.googleapis.com/auth/admin.directory.user.readonly,https://mail.google.com /, https://www.googleapis.com/auth/admin.directory.group.member.readonly,https://www.googleapis.com/auth/admin.directory.group.readonly

...输出的错误如下:

    2015-07-27 10:27:59 i.c.s.a.cv [DEBUG] failed get labels for user
    com.google.api.client.auth.oauth2.TokenResponseException: 403 Forbidden
    {
       "error" : "access_denied",
       "error_description" : "Requested client not authorized."
    }
Run Code Online (Sandbox Code Playgroud)

当然,谷歌这是不正确的?我错过了什么?文档不正确吗?需要添加什么认证范围?

我正在与Java Google API客户端库连接.请参阅:https://developers.google.com/api-client-library/java/google-api-java-client/reference/1.20.0/overview-summary

删除请求如下:

public void deleteMessages(Queue<String> messages, GoogleUserAdapter user) throws Exception {

    Gmail gmail = …
Run Code Online (Sandbox Code Playgroud)

gmail-api

3
推荐指数
1
解决办法
2446
查看次数

错误:字段类型不完整

我正在尝试将库移植到Mac OS X.编译器报告了一个不完整的类型错误.具体来说:字段具有不完整类型'header_t [].但是,当我查看源代码时,header_t在packet_state_t之前定义,其中packet_state_t引用header_t.因此,不应存在任何前向引用错误,因为header_t在packet_state_t内引用它的位置清楚地定义.发生错误的行在下面标有ERROR.怎么解决?

 typedef struct header_t {
    uint8_t  hdr_id;         // header ID

    uint8_t  hdr_prefix;     // length of the prefix (preamble) before the header
    uint8_t  hdr_gap;        // length of the gap between header and payload
    uint16_t  hdr_flags;      // flags for this header
    uint16_t hdr_postfix;    // length of the postfix (trailer) after the payload
    uint32_t hdr_offset;     // offset into the packet_t->data buffer
    uint32_t hdr_length;     // length of the header in packet_t->data buffer
    uint32_t hdr_payload;    // length of the payload

    uint8_t   hdr_subcount; …
Run Code Online (Sandbox Code Playgroud)

c struct

2
推荐指数
1
解决办法
1万
查看次数