springsecurity對於springboot1.5和2.0的改動

springsecurity對於springboot1.5和2.0的改動

spring-boot2.0版本
http.getSharedObject(AuthenticationManager.class)取不到AuthenticationManager對象
解決方法爲
super.authenticationManagerBean()

配置客戶端時

@Override
	public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
		clients.inMemory()
				.withClient("imooc1")
				//新版本改動  這裏必須加密
				.secret(passwordEncoder().encode("imoocsecrect1"))
				// 必須指定回調地址  這裏爲登錄請求
				.redirectUris("http://localhost:8080/client1/login")
				.authorizedGrantTypes("authorization_code", "refresh_token")
				.scopes("all")
				.and()
				.withClient("imooc2")
				//新版本改動  這裏必須加密  
				.secret(passwordEncoder().encode("imoocsecrect2"))
				// 必須指定回調地址  這裏爲登錄請求
				.redirectUris("http://localhost:8060/client2/login")
				.authorizedGrantTypes("authorization_code", "refresh_token")
				.scopes("all");
	}

尋找token_key時

2.0 必須配置這個屬性
security.oauth2.resource.jwt.key-value=imooc

其他小知識點

這個屬性  配置回調地址  默認 /login
security.oauth2.sso.login-path 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章