Authentication和Authorization的区别

autentication: 你是谁
authorization:能干什么
SAML 不是oauth 2.0的一部分,配合用。

yaas:oauth + openid connect
scp: oauth + saml

自己的resource
第三方 service

oauth client:体系的客户端,消费资源的那一方

service platform:就是google cloud platform - SCP
user agent: 输用户名和密码的框 被重定向到domain
auth server: 签发token 的server Spring: 自己做oauth server,
resource owner:终端用户
resource server: 包含了resource的东西。
sci ias - 浏览器,返回一个网页(不属于cec)就是user agent

token还有scope的概念。
user agent背后的IDP做的。IDP和XX有一个configure过程。authization的伙伴告诉我这是伙伴认证code, code和token不一样。最后发给你的是token。

展开阅读全文

spring-security 配置<security:form-login>不起作用

07-29
其他的标签配置都有效就这个标签无效导致了一直无法拿到自己设置的自定义username参数,请问这是什么问题 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd"> <!-- 设置不拦截的资源url--> <security:http security="none" pattern="/css/**" /> <security:http security="none" pattern="/js/**" /> <security:http security="none" pattern="/images/**" /> <security:http security="none" pattern="/favicon.ico"/> <security:http security="none" pattern="/login*" /> <security:http security="none" pattern="/login/sendSms" /> <security:http security="none" pattern="/captchaServlet"/> <security:http security="none" pattern="/activecode*"/> <security:http security="none" pattern="/sendEmail*"/> <security:http security="none" pattern="/register*" /> <security:http security="none" pattern="/check/**" /> <security:http security="none" pattern="/accessDenied"/> <security:http security="none" pattern="/page/reply"/> <security:http security="none" pattern="/page/pages"/> <security:http auto-config="false" access-decision-manager-ref="accessDecisionManager" use-expressions="true" entry-point-ref="loginEntryPoint"> <!-- 禁用frame-option不禁用会阻止加载任何frame页面,包括图片上传超时--> <security:headers> <security:frame-options disabled="true"></security:frame-options> </security:headers> <!-- 配置登录页信息,分别为登录 URL、认证失败跳转 URL、认证成功跳转 URL、登录 URL、password 和 username 请求参数名称--> <security:form-login login-page="/login.jsp" authentication-failure-url="/login.jsp?error=1" login-processing-url="/login/doLogin" password-parameter="password" default-target-url="/personal/list" username-parameter="email" /> <security:access-denied-handler ref="accessDeniedHandler" /> <!-- 禁用csrf--> <security:csrf disabled="true"/> <security:intercept-url pattern="/" access="permitAll"/> <security:intercept-url pattern="/index**" access="permitAll"/> <security:intercept-url pattern="/login/sendSms" access="permitAll"/> <security:intercept-url pattern="/**" access="hasRole('ROLE_USER')"/> <!-- session失效url session策略--> <security:session-management invalid-session-url="/index.jsp" session-authentication-strategy-ref="sessionStrategy"> </security:session-management> <!-- spring-security提供的过滤器 以及我们自定义的过滤器 authenticationFilter--> <security:custom-filter ref="logoutFilter" position="LOGOUT_FILTER" /> <security:custom-filter before="FORM_LOGIN_FILTER" ref="authenticationFilter"/> <security:custom-filter ref="concurrencyFilter" position="CONCURRENT_SESSION_FILTER"/> </security:http> <bean id="accessDeniedHandler" class="com.dream.sercurity.Account.MyAccessDeniedHandler"> <property name="errorPage" value="/accessDenied.jsp" /> </bean> <bean id="loginEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> <!-- 用户未登录访问保护资源后弹到默认登录页的url --> <constructor-arg value="/login.jsp?error=login"/> </bean> <!-- 启用表达式 为了后面的投票器做准备 --> <bean class="org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler" id="expressionHandler"/> <bean class="org.springframework.security.web.access.expression.WebExpressionVoter" id="expressionVoter"> <property name="expressionHandler" ref="expressionHandler"/> </bean> <!-- 认证管理器,使用自定义的accountService,并对密码采用md5加密 --> <security:authentication-manager alias="authenticationManager"> <security:authentication-provider user-service-ref="accountService"> <security:password-encoder hash="md5"> <security:salt-source user-property="email"></security:salt-source> </security:password-encoder> </security:authentication-provider> </security:authentication-manager> <bean id="authenticationFilter" class="com.dream.sercurity.Account.AccountAuthenticationFilter"> <property name="filterProcessesUrl" value="/login/doLogin"></property> <property name="authenticationManager" ref="authenticationManager"></property> <property name="sessionAuthenticationStrategy" ref="sessionStrategy"></property> <property name="authenticationSuccessHandler"> <bean class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> <property name="defaultTargetUrl" value="/personal/list"></property> </bean> </property> <property name="authenticationFailureHandler"> <bean class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> <property name="defaultFailureUrl" value="/login.jsp?error=fail"></property> </bean> </property> </bean> <bean id="logoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter"> <!-- 处理退出的虚拟url --> <property name="filterProcessesUrl" value="/loginout" /> <!-- 退出处理成功后的默认显示url --> <constructor-arg index="0" value="/login.jsp?logout" /> <constructor-arg index="1"> <!-- 退出成功后的handler列表 --> <array> <bean id="securityContextLogoutHandler" class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler" /> </array> </constructor-arg> </bean> <!-- ConcurrentSessionFilter过滤器配置(主要设置账户session过期路径) --> <bean id="concurrencyFilter" class="org.springframework.security.web.session.ConcurrentSessionFilter"> <constructor-arg ref="sessionRegistry"></constructor-arg> <constructor-arg value="/login?error=expired"></constructor-arg> </bean> <bean id="sessionStrategy" class="org.springframework.security.web.authentication.session.CompositeSessionAuthenticationStrategy"> <constructor-arg> <list> <bean class="org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy"> <property name="maximumSessions" value="1"></property> <property name="exceptionIfMaximumExceeded" value="false"></property> <constructor-arg ref="sessionRegistry"/> </bean> <bean class="org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy"/> <bean class="org.springframework.security.web.authentication.session.RegisterSessionAuthenticationStrategy"> <constructor-arg ref="sessionRegistry"/> </bean> </list> </constructor-arg> </bean> <bean id="sessionRegistry" scope="singleton" class="org.springframework.security.core.session.SessionRegistryImpl"></bean> <bean id="accountService" class="com.dream.sercurity.Account.AccountDetailsService"/> <!-- An access decision voter that reads ROLE_* configuration settings --> <bean id="roleVoter" class="org.springframework.security.access.vote.RoleVoter"/> <bean id="authenticatedVoter" class="org.springframework.security.access.vote.AuthenticatedVoter"/> <bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased"> <constructor-arg> <list> <ref bean="roleVoter"/> <ref bean="authenticatedVoter"/> <ref bean="expressionVoter"/> </list> </constructor-arg> </bean> </beans> ``` ```
©️2020 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值