我有一个行为奇怪的应用程序,只是为了验证,我想看看它当前正在运行的安全区域.
我找到了System.Security.SecurityZone枚举,但似乎无法找到任何会返回我正在运行的内容.
有人有任何提示吗?
基本上我想知道我的应用程序是否在MyComputer,Intranet,Internet,Untrusted,Trusted等运行.
编辑:这是我编写的用于查找此代码的次要测试应用程序,感谢@blowdart.
using System;
using System.Reflection;
namespace zone_check
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(".NET version: " + Environment.Version);
foreach (Object ev in Assembly.GetExecutingAssembly().Evidence)
{
if (ev is System.Security.Policy.Zone)
{
System.Security.Policy.Zone zone = (System.Security.Policy.Zone)ev;
Console.WriteLine("Security zone: " + zone.SecurityZone);
break;
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 我的应用程序包括一个用于更新应用程序的自更新程序可执行文件.
updater执行的第一个步骤之一是检查它是否具有对应用程序文件夹的写入权限
IPermission perm = new FileIOPermission(FileIOPermissionAccess.AllAccess, _localApplicationCodebase);
if (!SecurityManager.IsGranted(perm))
{
OnProgressChanged("Security Permission Not Granted \n The updater does not have read/write access to the application's files (" +
_localApplicationCodebase + ")",MessageTypes.Error);
return false;
}
OnProgressChanged("Updater have read/write access to local application files at " + _localApplicationCodebase);
return true;
Run Code Online (Sandbox Code Playgroud)
IPermission perm = new FileIOPermission(FileIOPermissionAccess.AllAccess, _localApplicationCodebase);
if (!SecurityManager.IsGranted(perm))
{
OnProgressChanged("Security Permission Not Granted \n The updater does not have read/write access to the application's files (" +
_localApplicationCodebase + ")",MessageTypes.Error);
return …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用CAS和Spring Security在多个Web应用程序中实现SSO.预期案例:
CAS - http:// localhost:8080/cas/
App受
保护的内容 - http://localhost:8081/ cas-client1/secure/ index.html App B受保护的内容 - http:// localhost:8081/CAS-客户机程序/安全/ index.html的
1)当用户访问cas-client1时,将提示CAS登录表单并触发认证.
2)相同的用户访问cas-client2,应该识别以前的登录,并且不会提示登录表单
但是,我未能执行第2步.CAS登录表单仍然提示用户,因此需要双重登录.我的Spring Security配置中是否有任何错误设置:
<security:http entry-point-ref="casAuthenticationEntryPoint" auto-config="true">
<security:intercept-url pattern="/secure/**" access="ROLE_USER" />
<security:custom-filter position="CAS_FILTER" ref="casAuthenticationFilter" />
</security:http>
<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="http://localhost:8080/cas/login" />
<property name="serviceProperties" ref="serviceProperties" />
</bean>
<bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
<!-- http://localhost:8081/cas-client2 for app 2-->
<property name="service" value="http://localhost:8081/cas-client1/j_spring_cas_security_check" />
</bean>
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="casAuthenticationProvider" />
</security:authentication-manager>
<bean id="casAuthenticationFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager" />
<property name="authenticationFailureHandler">
<bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
<property name="defaultFailureUrl" value="/casfailed.jsp" /> …Run Code Online (Sandbox Code Playgroud) 我正在为一所使用Shibboleth验证学生的大学编写一个Android应用程序.
由于我正在制作一个Android原生应用程序(不是webview),我想以编程方式传递用户名和密码并获取用户的用户凭据.Shibboleth有一个我可以使用的宁静api.
对于前 CAS有https://wiki.jasig.org/display/CASUM/RESTful+API,它允许我以编程方式发送用户名和密码并获取票证凭据.shibboleth有类似的东西吗?
我正在开发一个允许用户创建帐户的网站.然后,网站开发人员将能够将该身份验证系统集成到他们的站点中,并允许用户使用我的站点登录凭据登录.我想这样做类似于facebook连接的工作方式,这样用户网站不需要重定向到我的网站登录,然后我们回调他们来自的页面.
我知道facebook使用cookies,但我不确定他们是如何检查他们是否已登录.
我注意到的事情:
因此,看起来他们正在使用跨域cookie或其他东西,但我不知道如何做到这一点.
知道Facebook Connect如何正常工作的人可以解释我如何在我自己的系统中实现这一功能吗?
我有json-rpc服务只接受http POST-req并希望它使用CAS SSO auth.当前的请求流看起来大致如下:
POST host/service/ -> 302 redirect
GET host/cas/login?service=https%3A%2F%2Fhost%2Fservice%2F -> 302 redirect
GET host/service/?ticket=ST-16-0rtrEQunbcbNdP16Eu07-cas -> 302 redirect
GET host/service/ -> 405 GET Method not supported
Run Code Online (Sandbox Code Playgroud)
我想我们需要将最后的GET转换为POST,并保存原始的post body params.任何提示?在spring-sec链中添加裸RequestCacheAwareFilter并没有帮助.
使用纯Spring Java Config我很难让Spring和CAS执行单点注销.我有单点登录使用下面的配置.我使用一个简单的JSP页面对url https://nginx.shane.com/app/logout执行表单POST,并在POST'd数据中包含CSRF值.这一切似乎都没有错误,但是当我进入安全页面时,它只是让我回来而无需登录.有任何想法吗?
@Configuration
@EnableWebSecurity
public class SecurityWebAppConfig extends WebSecurityConfigurerAdapter {
@Bean
protected ServiceProperties serviceProperties() {
ServiceProperties serviceProperties = new ServiceProperties();
serviceProperties.setService("https://nginx.shane.com/app/j_spring_cas_security_check");
serviceProperties.setSendRenew(false);
return serviceProperties;
}
@Bean
public CasAuthenticationProvider casAuthenticationProvider() {
CasAuthenticationProvider casAuthenticationProvider = new CasAuthenticationProvider();
casAuthenticationProvider.setAuthenticationUserDetailsService(authenticationUserDetailsService());
casAuthenticationProvider.setServiceProperties(serviceProperties());
casAuthenticationProvider.setTicketValidator(cas20ServiceTicketValidator());
casAuthenticationProvider.setKey("an_id_for_this_auth_provider_only");
return casAuthenticationProvider;
}
@Bean
public AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService() {
return new TestCasAuthenticationUserDetailsService();
}
@Bean
public Cas20ServiceTicketValidator cas20ServiceTicketValidator() {
return new Cas20ServiceTicketValidator("https://nginx.shane.com/cas");
}
@Bean
public CasAuthenticationFilter casAuthenticationFilter() throws Exception {
CasAuthenticationFilter casAuthenticationFilter = new CasAuthenticationFilter();
casAuthenticationFilter.setAuthenticationManager(authenticationManager());
return casAuthenticationFilter;
}
@Bean …Run Code Online (Sandbox Code Playgroud) 我是liferay 7的新手,我想使用ldap将liferay 7与CAS服务器集成.
我的liferay的版本是7.0.2 GA3,CAS服务器的版本是3.5.2,我正在使用opendj活动目录.
我在localhost上安装了liferay:8080,CAS服务器在ssl上的一台服务器上,ldap在同一台服务器上.
我已经成功地将CAS与ldalp集成,我可以从ldap用户登录CAS服务器.在此之后,我在liferay中配置了CAS身份验证,该身份验证位于此CAS选项卡下的Configuration-> Instance Setting-> Authentication中.当我尝试登录即时获取以下网址时:
HTTP://本地主机:8080 /票务= ST-36-tP25deAgea9pUfwEcf6V-cas01.example.org
虽然门票正在生成,但我无法访问管理面板.
请帮助,谢谢你的推荐
我使用Apereo CAS(以前的Jasig CAS)(这里是github).接下来,我在Vaadin中创建了一个非常简单的应用程序,它在身份验证期间连接到CAS.一切都无缝地工作,直到我从Spring Security开启CSRF.
如果打开CSRF,则重定向到CAS登录页面可以正常工作.但是在成功验证(登录,passoword)之后,CAS想要重定向回我的应用程序.然后我看到了这个:
{
"timestamp": 1498657046424,
"status": 403,
"error": "Forbidden",
"message": "Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-XSRF-TOKEN'.",
"path": "/contextPath/"
}
Run Code Online (Sandbox Code Playgroud)
我使用Spring Boot @EnableWebSecurity,所以请从那里看一下配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.addFilter(casAuthenticationFilter())
.addFilterBefore(singleSignOutFilter(), CasAuthenticationFilter.class)
.exceptionHandling()
.authenticationEntryPoint(casAuthenticationEntryPoint())
.and()
.authorizeRequests()
.antMatchers("/login")
.permitAll()
.anyRequest()
.authenticated();
http.csrf().disable(); //works when disable
}
Run Code Online (Sandbox Code Playgroud)
我的问题: 如何使用CAS身份验证配置Spring Security以使CSRF正常工作?
我正在使用Spring Boot 1.5.4.RELEASE(maven parent)和Vaadin 8.0.5(BOM).
我的目标是运行CAS来替换ADFS.我认为从码头图像开始是一个好的开始.
我试过运行两个不同的版本,apereo/cas都有相同的错误.
这是我尝试过的.
docker run -p 8080:8080 -p 8443:8443 apereo/cas:v5.3.2
Run Code Online (Sandbox Code Playgroud)
__ ____ _ ____ __
/ / / ___| / \ / ___| \ \
| | | | / _ \ \___ \ | |
| | | |___ / ___ \ ___) | | |
| | \____| /_/ \_\ |____/ | |
\_\ /_/
CAS Version: 5.3.2
CAS Commit Id: 145d8c3dd5e27333dd05f5cc10987df4656fba5e
CAS Build Date/Time: 2018-07-30T21:09:46Z
Spring Boot Version: 1.5.14.RELEASE
Spring Version: 4.3.18.RELEASE
Java …Run Code Online (Sandbox Code Playgroud)