小编Mat*_* Kh的帖子

我如何拥有所有登录的用户列表(通过spring security)我的Web应用程序

我在我的Web应用程序中使用spring security,现在我想要列出所有登录我程序的用户.

我怎样才能访问该列表?它们不是已经存在于spring框架内的某个地方吗?像SecurityContextHolderSecurityContextRepository

spring login web-applications spring-security

66
推荐指数
5
解决办法
4万
查看次数

如何在spring security中编写自定义过滤器?

我希望每个请求都能收到一些信息,所以我认为不是每个请求都有一个函数,而是单独从请求中获取这些信息,最好有一个过滤器.
因此,每个请求都应通过该过滤器,并获得我想要的.


问题是:如何编写自定义过滤器?
假设它不像任何预定义的弹簧安全过滤器,它是全新的.

spring filter spring-security

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

安装rgl包时出错

我在这里看到了这个问题:使用Mac OS X加载rgl包时出错,但没有提到安装错误,这是我的情况.我无法rgl使用以下命令安装软件包R:

source("http://bioconductor.org/biocLite.R")
biocLite("rgl")
Run Code Online (Sandbox Code Playgroud)

显示以下错误:

source("http://bioconductor.org/biocLite.R")
biocLite("rgl")
Run Code Online (Sandbox Code Playgroud)

我检查了这个地址/Library/Frameworks/R.framework/Versions/3.2/Resources/library,没有rgl文件夹,所以我不能删除aglrgl.so(或rgl.so),这是上述问题的答案.你能帮我解决这个安装问题吗?谢谢.

linux macos r rgl

41
推荐指数
5
解决办法
4万
查看次数

如何在Spring Security中查找用户的IP?

我需要找到那些登录我们的应用程序的用户.
我们正在使用Spring Security,必须有办法找出用户的IP.

我认为这些信息存储在他们的会话中.在Spring Security中,当前会话存储在SessionRegistry中.从这个类我可以有经过身份验证的用户列表和一些会话信息.(使用getAllPrincipals,getAllSessionsgetSessionInformation)

的问题是,我怎么能有机会获得当前用户的IP地址?考虑我们必须仅为已知区域提供服务.
SessionInformation没有太大的帮助,因为它并不包含太多的信息.

ip session spring spring-security

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

使用restful方法重定向到页面?

我创建了一个页面,要求用户填写一些表单字段,当他提交时,表单将被发送到Restful方法,您可以在下面看到:

@POST
@Path("addUser")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void addUser(@FormParam("username") String username,
        @FormParam("password") String password,
        @FormParam("id") String id,
        @FormParam("group_name") String groupName,
        @FormParam("authority_name") String authorityName,
        @FormParam("authority_id") String authorityId
        )
{
    //Something will be done here
}
Run Code Online (Sandbox Code Playgroud)


如何在此函数结束时将用户重定向到(比方说)index.jsp?

java rest redirect

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

如何在JAVA中查看完整的异常日志?

当我使用命令java ExceptionTest运行一些java程序时,有时会省略异常并且看起来像

Exception in thread "main" java.lang.NoClassDefFoundError: aa/bb/DD
        at SOMEWHERE(unknown source)
Caused by: java.lang.ClassNotFoundException: aaa.bbb.CC
        at SOMEWHER(unknown source)
        ... 13 more
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我想看到另外13个例外.是否有选项可以查看所有异常日志?

java exception-logging

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

SpringMvc DAO接口和DAO实现的注释

我想知道我是否正确地注释这些类,因为我是注释的新手:

Country.java

@Component
public class Country {

private int countryId;
private String countryName;
private String countryCode;

/**
 * No args constructor
 */
public Country() {
}

/**
 * @param countryId
 * @param countryName
 * @param countryCode
 */
public Country(int countryId, String countryName, String countryCode) {
    this.countryId = countryId;
    this.countryName = countryName;
    this.countryCode = countryCode;
}
    //getters and setters   

}
Run Code Online (Sandbox Code Playgroud)

CountryDAO.java

@Repository
public interface CountryDAO {

    public List<Country> getCountryList();

    public void saveCountry(Country country);

    public void updateCountry(Country country);
}
Run Code Online (Sandbox Code Playgroud)

JdbcCountryDAO.java

@Component
public …
Run Code Online (Sandbox Code Playgroud)

java annotations spring-mvc

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

Spring Security - 我可以同时使用命名空间和过滤器链吗?

我正在使用spring security,我必须同时使用filter-chain和namespace.命名空间工作正常,但似乎过滤链没有!
这是我的配置.首先,命名空间:

<sec:global-method-security secured-annotations="enabled" />

<sec:http pattern="/app/login.jsp*" security="none" />
<sec:http pattern="/admin/login.jsp*" security="none" />
<sec:http pattern="/app/*.png" security="none" />
<sec:http pattern="/admin/*.png" security="none" />
<sec:http pattern="/app/**" authentication-manager-ref="authenticationManager"
    access-decision-manager-ref="accessDecisionManager">
    <sec:intercept-url pattern="/app/**" access="ROLE_USER" />
    <sec:access-denied-handler error-page="/app/login.jsp?aer=" />
    <sec:form-login login-processing-url="/app/j_spring_security_check"
        always-use-default-target="true" default-target-url="/app/index.html"
        login-page='/app/login.jsp' authentication-failure-url='/app/login.jsp?login_error' />
    <sec:logout logout-url="/app/j_spring_security_logout"
        invalidate-session="true" logout-success-url="/app/login.jsp" />
</sec:http>
<sec:http pattern="/admin/**" authentication-manager-ref="authenticationManager"
    access-decision-manager-ref="accessDecisionManager">
    <sec:intercept-url pattern="/admin/**" access="ROLE_ADMIN" />
    <sec:access-denied-handler error-page="/admin/login.jsp?aer=" />
    <sec:form-login login-processing-url="/admin/j_spring_security_check"
        always-use-default-target="true" default-target-url="/admin/index.html"
        login-page='/admin/login.jsp' authentication-failure-url='/admin/login.jsp?login_error' />
    <sec:logout logout-url="/admin/j_spring_security_logout"
        invalidate-session="true" logout-success-url="/admin/login.jsp" />
</sec:http>
Run Code Online (Sandbox Code Playgroud)


这很好用.但是我还需要一个过滤器链来检查其他请求.(这些请求是动态创建的,我们必须以这种方式控制它们)
这是我的过滤器链:

<bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <security:filter-chain-map path-type="ant">

    <sec:filter-chain pattern="/css/**" filters="none" …
Run Code Online (Sandbox Code Playgroud)

spring spring-security

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

通过休眠创建视图

有没有办法在使用hibernate.hbm2ddl.auto属性创建表时创建视图.我使用注释类型来定义表及其字段.是否有任何属性可用于通过休眠创建视图?

java spring annotations hibernate view

5
推荐指数
2
解决办法
8290
查看次数

在matlab中打印多个数字

假设我在我的程序中生成了几个数字.我想让用户可以选择一次打印所有内容.我不想为每个页面显示打印对话框.因此,我只显示一次,仅显示第一个数字.这是我到目前为止提出的解决方案:

figHandles = get(0, 'Children');
for currFig = 1:length(figHandles)
    if(currFig == 1)
        printdlg(figHandles(currFig)); % Shows the print dialog for the first figure
    else
        print(figHandles(currFig)); % Does not show the print dialog and uses the latest printer selection
    end
end
Run Code Online (Sandbox Code Playgroud)

但问题是,如果用户取消第一个数字的打印,我无法抓住它并取消其他打印.我该怎么做?

matlab printdialog matlab-figure

5
推荐指数
1
解决办法
373
查看次数