您可以在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.JdbcOdbc...