我仍在尝试为SSO(在*nix上运行)找到基于Java的解决方案,我可以在JBoss上使用它来针对Active Directory /域控制器进行授权.我最初尝试通过NTLM执行此操作,但放弃了因为它在Windows Server> = 2008上不受支持.
因此,我正在尝试使用Kerberos实现此功能,但似乎无法找到正确/可行的解决方案.请指出正确的方向,说明如何设置这样的配置,如何验证Active Directory和/或域控制器,以便:
任何帮助表示赞赏!
UPDATE
我正在使用jcifs-ext-0.9.4和jcifs-krb5-1.3.12开发解决方案.我按如下所述设置了web.xml:
<web-app>
<!-- servlet / servlet-mapping / welcome-file-list skipped -->
<filter>
<filter-name>auth</filter-name>
<filter-class>jcifs.http.AuthenticationFilter</filter-class>
<init-param>
<param-name>java.security.auth.login.config</param-name>
<param-value>/WEB-INF/login.conf</param-value>
</init-param>
<init-param>
<param-name>jcifs.spnego.servicePrincipal</param-name>
<param-value>HTTP/testconn@mydomain.com</param-value>
</init-param>
<init-param>
<param-name>jcifs.spnego.servicePassword</param-name>
<param-value>supersecret</param-value>
</init-param>
<init-param>
<param-name>sun.security.krb5.debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>java.security.krb5.realm</param-name>
<param-value>mydomain.com</param-value>
</init-param>
<init-param>
<param-name>java.security.krb5.kdc</param-name>
<param-value>testdom01.mydomain.com </param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.client.domain</param-name>
<param-value>TESTDOMAIN</param-value>
</init-param>
<init-param>
<param-name>jcifs.http.enableNegotiate</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>jcifs.http.basicRealm</param-name>
<param-value>mydomain.com</param-value>
</init-param>
<init-param>
<param-name>jcifs.http.domainController</param-name>
<param-value>testdom01.mydomain.com</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>auth</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
如果尝试访问应用程序,这会导致以下堆栈跟踪:
2010-07-22 15:53:10,588 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/google].[default]] Servlet.service() for servlet …Run Code Online (Sandbox Code Playgroud) java authentication kerberos active-directory single-sign-on
我试图让Spring中的控制器返回一个JSON响应无法使用3.0推荐的Jackson类.我当然在我的课程路径中获得了jackson jar文件(jackson-core-asl-1.5.5.jar和jackson-mapper-asl-1.5.5.jar).
至于appconfig.xml条目,我不确定我是否需要这些.在回到'时尚非json ajax'之前,我把它们放在那里作为最后的绝望行为.
在调试中,我看到控制器获取请求,返回foo然后,在firebug中,获得406.
错误消息如下:从记录器设置为debug时:org.springframework.web.HttpMediaTypeNotAcceptableException:找不到可接受的表示
根据响应:(406)该请求标识的资源仅能够根据请求"accept"headers()生成具有不可接受特性的响应.
我的appconfig.xml在这里:
<!-- Configures support for @Controllers -->
<mvc:annotation-driven />
<!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="html" value="text/html"/>
<entry key="json" value="application/json"/>
</map>
</property>
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
</list>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
</list>
</property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages"></property>
</bean>
Run Code Online (Sandbox Code Playgroud)
我的控制器
@RequestMapping(value="foo/bar", method=RequestMethod.GET)
public …Run Code Online (Sandbox Code Playgroud) 使用spring security时,特别是@notation; 在Controller中访问主体的正确方法是什么?让我们说以下是我的控制器,但我想在某个地方访问secure()方法中的主体...
@Controller
public class LoginController {
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login(ModelMap map, @RequestParam(value="fail" , required=false) String fail){
map.addAttribute("title", "Login: AD Credentials");
if(fail != null){
map.addAttribute("error", "Invalid credentials");
}
return("login");
}
@RequestMapping("/secure")
@PreAuthorize("isAuthenticated()")
public String secure(ModelMap map, String principal){
System.out.println(principal);
return("secure");
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用jaxb2 xjc插件从a生成java文件XSD.因此,我曾经按如下方式配置我的pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<packageName>com.mypackage.model</packageName>
<schemaDirectory>${basedir}/src/main/resources/XSD</schemaDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
我将我的开发环境改为Eclipse Indigo,这不再适用了.错误说:"生命周期配置未涵盖插件执行".我知道我必须以不同的方式定义我的插件的执行,以便它在我的新环境中工作.
我按照本页上的说明M2E插件执行未涵盖但执行generate-sources阶段时未生成源文件.
任何人都可以告诉我如何精确重构我的pom,以便我的文件正确生成?
谢谢你的帮助!
有人可以向我解释一下CXF的以下行为吗?
我有简单的WebService:
import javax.jws.WebMethod;
public interface MyWebService {
@WebMethod
String method1(String s);
@WebMethod
String method2(String s);
@WebMethod(exclude = true)
String methodToExclude(String s);
}
Run Code Online (Sandbox Code Playgroud)
我想拥有我的methodToExcludein接口(对于Spring),但我不想在生成的WSDL文件中使用此方法.上面的代码确实如此.
但是当我@WebService向界面添加注释时,我得到错误:
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface MyWebService {
@WebMethod
String method1(String s);
@WebMethod
String method2(String s);
@WebMethod(exclude = true)
String methodToExclude(String s);
}
Run Code Online (Sandbox Code Playgroud)
org.apache.cxf.jaxws.JaxWsConfigurationException:@ javax.jws.WebMethod(exclude = true)不能在服务端点接口上使用.方法:methodToExclude
谁可以给我解释一下这个?有什么不同?此外,我不确定它是否会在以后工作正常,但我没有找到如何排除methodToExclude我使用时的方式@WebService.
我知道,这真的很难过,但我无法连接到MySQL数据库.
我只是从MySQL站点下载并解压缩mysql-5.6.10-win32.zip.
我按照本教程,但我无法以root身份连接到我的MySQL数据库.
我知道在没有密码的情况下以root身份连接是不安全的,但我只需要做一些测试,所以我现在可以这样做(如果我知道如何以root身份连接我知道如何添加其他用户太).
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% …Run Code Online (Sandbox Code Playgroud) 我想从日期时间字段的Soap UI传递空值一个选项是我应该删除标记.还有其他方法可以在日期字段中传递null或其他值.
<rt6:DateofBirth></rt6:DateofBirth>
Run Code Online (Sandbox Code Playgroud) JAXB简单绑定模式将集合名称修改为其复数"版本",例如"additionalData"变为"additionalDatas".有没有改变这种行为的解决方案?我需要一个Java字段名称和方法名称等于XSD字段名称.我的绑定文件:
<?xml version="1.0" encoding="UTF-8"?>
<bindings xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xsi:schemaLocation="
http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
version="2.1">
<globalBindings>
<serializable uid="1" />
<xjc:simple/>
</globalBindings>
</bindings>
Run Code Online (Sandbox Code Playgroud) 我有一个tomcat7.访问管理器应用程序(http:// localhost:7777/manager/html)可以使用tomcat-users.xml中定义的凭据正常工作.
现在我想用maven3部署一个应用程序.我配置了tomcat maven插件:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<url>http://localhost:7777/manager</url>
<server>localhost7777</server>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<url>http://localhost:7777/manager</url>
<server>localhost7777</server>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
在mavens setting.xml中,我添加了服务器的条目:
<servers>
<server>
<id>localhost7777</id>
<username>manager</username>
<password>secret</password>
</server>
</servers>
Run Code Online (Sandbox Code Playgroud)
现在应用程序将成功构建.但目标tomcat7:deploy导致tomcat发出访问被拒绝错误消息:
...
[INFO] Deploying war to http://localhost:7777/workload-monitor
Uploading: http://localhost:7777/manager/deploy?path=%2Fworkload-monitor&update=true
Uploaded: http://localhost:7777/manager/deploy?path=%2Fworkload-monitor&update=true (2329 KB at 55435.1 KB/sec)
[INFO] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
[INFO] <html>
[INFO] <head>
[INFO] <title>403 Access Denied</title>
[INFO] <style type="text/css">
[INFO] <!--
...
Run Code Online (Sandbox Code Playgroud)
有人可以给我一个暗示吗?
我有这个测试课
import javax.xml.bind.annotation.XmlElement;
class CompileTest {
void foo( @XmlElement String in ) {
}
}
Run Code Online (Sandbox Code Playgroud)
我的java版本是
$ java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
Run Code Online (Sandbox Code Playgroud)
当我尝试编写那个我正在学习的课程时
javac CompileTest.java
CompileTest.java:5: annotation type not applicable to this kind of declaration
void foo( @XmlElement String in ) {
^
1 error
Run Code Online (Sandbox Code Playgroud)
这对Java 6有效.当我尝试将更新的JAXB库添加到类路径时,它没有帮助.有办法解决这个问题吗?
javac -cp jaxb-api-2.2.4.jar CompileTest.java
Run Code Online (Sandbox Code Playgroud)