您可以在spring安全性休息中过期后刷新access_token吗?

如何解决您可以在spring安全性休息中过期后刷新access_token吗?

查看需要发布到/ oauth / access_token的文档

using System;

namespace ConsoleApp6
{
    class Program
    {
        interface IWalkable
        {
            void Walk(int xAxis,int yAxis);
        }

        class Robot : IWalkable
        {
            public int RobotId { get; set; }
            public Robot(int robotId)
            {
                RobotId = robotId;
                Console.Write("Robot created! \n");
            }

            public void Walk(int xAxis,int yAxis)
            {
                Console.WriteLine("Im walking beep boop");
                Console.WriteLine("*walks*");
                Console.WriteLine($"Ended up in X: {xAxis} y:{yAxis}");

            }
        }

        class BadRobot : Robot
        {
            public BadRobot(int robotId) : base(robotId)
            {

            }
        }

        class Dog : IWalkable
        {
            public Dog()
            {
                Console.Write("Dog created! \n");
            }

            public void Walk(int xAxis,int yAxis)
            {
                Console.WriteLine("Im walking,roof roof");
                Console.WriteLine("*walks*");
                Console.WriteLine($"Ended up in X: {xAxis} y:{yAxis}");
            }

            public virtual void Breath()
            {
                Console.WriteLine("I breath normal");
            }
        }

        class BadDog : Dog
        {
            public override void Breath()
            {
                Console.WriteLine("I breath normal");
                Console.WriteLine("But then I bark,because im bad");
            }

            //I can't "extend" an interface
            //but I can extend a virtual method from the base class
        }


        static void Main(string[] args)
        {
            //three tips over inheritance

            //1. If you want to abstract some *behavior*,you probably want an interface: 
            //for example here,both dogs and robots can walk. They are going to do that
            //on their own way,so each need their own proper implementation,//but the actions is the same thus,the interface
            // An interface is meant to group objects over shared functionality
            //so for example I can later do something like this
            

            var dog = new Dog();
            var badDog = new BadDog();
            var badRobot = new BadRobot(1);
            
            // these function doesn't care if its a dog or a robot
            void WalkOverThere(IWalkable walkable)
            {
                //some other code...
                walkable.Walk(5,10);
            }

            //The key here is that the object pass over parameter implements the IWalk interface
            WalkOverThere(badDog);
            WalkOverThere(badRobot);

            //Please notice that for each class that inherits "IWalkable"
            //There will be a new implementation,so in this case,if 
            //all the robots inherit from the class robot,all will walk the same way
            //In that,I cannot extend,or modify how that method is performed in the base
            //class from the child class


            //2. Now,the case is different when we talk about some functionality that Could change 
            //for any child implementation of the base class. Think about the breath functionality
            //A robot can't breathe,but a dog does. And given that every dog breaths differently
            //it makes sense to create and virtual method,that means that I can reconfigure how
            //the breath method behaves. For example:

            dog.Breath();
            badDog.Breath();

            //3. Another thing that is useful to take into account is that
            //whenever I can't create a given object without some piece of information,//it makes sense to create the necessity of that data in the constructor.
            //take for example in this code that I cannot create a robot without a valid int robotId 
            //This practice enforces me to create a robot like:
            //var robot = new Robot(100); where 100 is the id
            //var robot = new Robot(); the compile would not allow that
        }
    }
}

该示例未随请求发送BEARER令牌,但带有grails 4.0.5和spring-security-rest-3.0.1,当我尝试刷新令牌时,除非我包括当前请求,否则该请求将被拒绝承载令牌。

如果当前的承载令牌已过期,则刷新消息将因尝试使用过期的令牌而被拒绝。

我正在使用以下filterChain(直接来自文档)

POST /myApp/oauth/access_token HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&refresh_token=eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ....

文档中还有其他一些关于设置ANONYMOUS_ACCESS的条目,但最终创建了一个会话,并导致了一些我还不太明白的怪异现象。

还有其他配置可以使“ / oauth / access_token”端点像“ / api / login”请求那样工作吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?