怎么才能登录后跳转到指定地址?(单点登录)

来源:6-11 基于JWT实现SSO单点登录2

他门说这就是人生

2019-09-05

报错:error=“invalid_grant”, error_description=“Invalid redirect: http://localhost:8082/login does not match one of the registered values: [http://192.168.0.101:8081/login, http://192.168.0.101:8082/login]”

我本机的IP地址是192.168.0.101

我的配置文件:

@Configuration
@EnableAuthorizationServer
public class SsoAuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {

    @Override
    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
        clients
                .inMemory()
                .withClient("client1").secret("clientSecret1")
                .authorizedGrantTypes("authorization_code", "refresh_token").scopes("all")
                .and()
                .withClient("client2").secret("clientSecret2")
                .authorizedGrantTypes("authorization_code", "refresh_token").scopes("all")
                .redirectUris("http://192.168.0.101:8081/login", "http://192.168.0.101:8082/login");
    }

    @Override
    public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
        endpoints.tokenStore(jwtTokenStore()).accessTokenConverter(jwtAccessTokenConverter());
    }

    @Override
    public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
        security.tokenKeyAccess("isAuthenticated()");
    }

    @Bean
    public TokenStore jwtTokenStore() {
        return new JwtTokenStore(jwtAccessTokenConverter());
    }

    @Bean
    public JwtAccessTokenConverter jwtAccessTokenConverter() {
        JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
        converter.setSigningKey("token-key");
        return converter;
    }
}

请问怎样才能跳转到192.168.0.101,而不是localhost?

写回答

1回答

JoJo

2019-09-16

发请求时redirect_uri填192.168.0.101不行吗?

0
0

Spring Security技术栈开发企业级认证与授权

Spring Security技术栈,REST风格开发常见接口,独立开发认证授权模块保证REST服务安全

2662 学习 · 1561 问题

查看课程