Explore all Application Framework open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Application Framework

laravel

v9.1.5

spring-boot

v2.6.7

rails

5.2.7

framework

devise

Popular Libraries in Application Framework

JavaGuide

by Snailclimb doticonjavadoticon

star image 110287 doticonApache-2.0

「Java学习+面试指南」一份涵盖大部分 Java 程序员所需要掌握的核心知识。准备 Java 面试,首选 JavaGuide!

laravel

by laravel doticonphpdoticon

star image 69346 doticon

Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things.

spring-boot

by spring-projects doticonjavadoticon

star image 60742 doticonApache-2.0

Spring Boot

rails

by rails doticonrubydoticon

star image 50532 doticonMIT

Ruby on Rails

CppCoreGuidelines

by isocpp doticonpythondoticon

star image 31706 doticonNOASSERTION

The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++

framework

by laravel doticonphpdoticon

star image 26780 doticonMIT

The Laravel Framework.

gitlabhq

by gitlabhq doticonrubydoticon

star image 22887 doticonNOASSERTION

GitLab CE Mirror | Please open new issues in our issue tracker on GitLab.com

devise

by heartcombo doticonrubydoticon

star image 22380 doticonMIT

Flexible authentication solution for Rails with Warden.

xxl-job

by xuxueli doticonjavadoticon

star image 19342 doticonGPL-3.0

A distributed task scheduling framework.(分布式任务调度平台XXL-JOB)

Trending New libraries in Application Framework

htmx

by bigskysoftware doticonjavascriptdoticon

star image 5943 doticonBSD-2-Clause

</> htmx - high power tools for HTML

octane

by laravel doticonphpdoticon

star image 3094 doticonMIT

Supercharge your Laravel application's performance.

virtual-event-starter-kit

by vercel doticontypescriptdoticon

star image 1688 doticonApache-2.0

Open source demo that Next.js developers can clone, deploy, and fully customize for events.

noticed

by excid3 doticonrubydoticon

star image 1581 doticonMIT

Notifications for Ruby on Rails applications

RandomImage

by unline2 doticonjavadoticon

star image 1451 doticonApache-2.0

一个能够获取随机图片的 Api,使用 SpringBoot 构建

good_job

by bensheldon doticonrubydoticon

star image 1296 doticonMIT

Multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.

turbo-rails

by hotwired doticonjavascriptdoticon

star image 1186 doticonMIT

Use Turbo in your Ruby on Rails app

vanilla-todo

by morris doticonjavascriptdoticon

star image 965 doticonISC

A case study on viable techniques for vanilla web development.

Neurax

by redcode-labs doticongodoticon

star image 805 doticonMIT

A framework for constructing self-spreading binaries

Top Authors in Application Framework

1

railscasts

38 Libraries

star icon182

2

spring-projects

36 Libraries

star icon84632

3

laracasts

28 Libraries

star icon645

4

Apress

27 Libraries

star icon730

5

koajs

27 Libraries

star icon4453

6

alphagov

27 Libraries

star icon329

7

codemuseum

27 Libraries

star icon56

8

swoft-cloud

26 Libraries

star icon5726

9

grosser

26 Libraries

star icon1132

10

kristianmandrup

24 Libraries

star icon501

1

38 Libraries

star icon182

2

36 Libraries

star icon84632

3

28 Libraries

star icon645

4

27 Libraries

star icon730

5

27 Libraries

star icon4453

6

27 Libraries

star icon329

7

27 Libraries

star icon56

8

26 Libraries

star icon5726

9

26 Libraries

star icon1132

10

24 Libraries

star icon501

Trending Kits in Application Framework

Here are some of the famous Python FastAPI Utility Libraries. The use cases of these libraries include Developing an API Backend, Automating System Tasks, Real-Time Data Processing, and Building Machine Learning Applications. 


Python FastAPI Utility Libraries are a set of libraries designed to make it easier to work with the Python FastAPI web framework. These libraries provide tools to help developers create and maintain their applications quickly and easily. They provide features such as automated documentation, robust request routing, validation, testing, logging, and more. 


Let us look at some of these famous libraries. 

loguru

  • Provides a rich set of features for tracking and debugging errors.
  • Supports integration with other Python libraries and frameworks.
  • Provides a number of convenience functions for quickly setting up logging with default configurations.

pydantic

  • Allows complex validations of data types, such as nested objects and lists.
  • Allows easy customization of data types and validation rules.
  • Provides an effortless way to convert data types between different formats, such as JSON, YAML, and XML. 

jinja

  • Provides a simple syntax for creating variables, loops, if-then-else statements, and more.
  • Provides developers with the ability to extend the language with custom filters, macros and functions.
  • Provides support for template inheritance.

starlette

  • Supports both ASGI and WSGI applications and works with any ASGI server.
  • Supports extensive type-hinting, making it easy to write strongly-typed code.
  • Provides a built-in debugger, making it easy to debug an application in real-time.

graphene

  • Provides an easy way to define custom resolvers, allowing one to build powerful custom GraphQL APIs.
  • Integrates seamlessly with existing Python libraries such as SQLAlchemy, Django ORM, and MongoEngine.
  • Provides built-in support for asynchronous and real-time GraphQL.

uvicorn

  • Supports a wide range of Python versions, from Python 3.6 and up.
  • Provides a convenient command-line interface for developers.
  • Offers a wide range of configuration options to customize the server to the application's needs. 

pyjwt

  • Supports cryptographic operations such as digital signatures and encryption.
  • Provides APIs for creating and validating JWT tokens.
  • Designed to be extensible, allowing developers to add their own custom algorithms or other features.

tortoise-orm

  • Allows users to define their models mapped to the underlying database.  
  • Provides powerful support for transactions.  
  • Provides a powerful query builder, making creating and executing complex queries easier. 

authlib

  • Provides an API for custom authentication flows.
  • Supports a variety of authentication methods that can be used to protect APIs.
  • Provides comprehensive documentation and a rich set of developer tools.

fastapi-utils

  • Provides built-in schema validation, so developers can easily ensure their API requests are valid.  
  • Allows developers to map requests and responses between their API and other services easily.  
  • Provides an effortless way for developers to create mock data for testing and development. 

Trending Discussions on Application Framework

Cant seem to fix this error in vscode : &quot;(&quot; was not closed

Get the request header in Plotly Dash running in gunicorn

How to compile 64-bit libraries for qwt-6.1.2 on Windows with command line

WinForms Startup Event not being handled

Creating a Custom Android ROM

java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage when starting Spring 5.0.7.RELEASE app. in Weblogic

Storing GET request parameters when initialising Open IDC auth dance for use after

Symfony 4.4 Auth0 how to completely logout user from the application

How to display blog post with HTML code snippets in Laravel

How should I properly go about null errors in my code?

QUESTION

Cant seem to fix this error in vscode : &quot;(&quot; was not closed

Asked 2022-Mar-26 at 09:19

I have been trying to make visualizations using plotly dash and wanted to try out the first app example from the sites documentaion. I copied and pasted most of the code and made sure to make the correct indentations but seem to keep getting an error on the brackets. Any advice?

1import dash
2import dash_core_components as dcc
3import dash_html_components as html
4
5external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
6
7app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
8
9app.layout = html.Div(children=[
10    html.H1(children='Hello Dash'),
11    
12    html.Div(children='''
13        Dash: A web application framework for Python.
14    '''),
15
16    dcc.Graph(
17        id='example-graph',
18        figure={
19            'data': [
20                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name':
21                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name':
22            ],
23
24            'layout': {
25                'title': 'Dash Data Visualization'
26            }
27        }
28    )
29])
30
31if __name__ == '__main__':
32app.run_server(debug=True)
33

ANSWER

Answered 2022-Mar-26 at 09:02

I have commented on the places where the brackets are not closed. Also, you are missing the values for "name". I have commented on it as well. P refers to parentheses (), C refers to curly brackets {} and S refers to square brackets [].

1import dash
2import dash_core_components as dcc
3import dash_html_components as html
4
5external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
6
7app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
8
9app.layout = html.Div(children=[
10    html.H1(children='Hello Dash'),
11    
12    html.Div(children='''
13        Dash: A web application framework for Python.
14    '''),
15
16    dcc.Graph(
17        id='example-graph',
18        figure={
19            'data': [
20                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name':
21                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name':
22            ],
23
24            'layout': {
25                'title': 'Dash Data Visualization'
26            }
27        }
28    )
29])
30
31if __name__ == '__main__':
32app.run_server(debug=True)
33import dash
34import dash_core_components as dcc
35import dash_html_components as html
36
37external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
38
39app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
40
41app.layout = html.Div(children=[          #P1 open, S1 open
42    html.H1(children='Hello Dash'),       # P2 open, P2 closed      
43    
44    html.Div(children='''                   
45        Dash: A web application framework for Python.
46    '''), # P3 open, P3 closed
47
48    dcc.Graph(                                  #P4 open
49        id='example-graph',         
50        figure={                                #C1 open
51            'data': [                           # S2 open
52                {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name':# You are missing name parameter here;  Also C2 open; You are not closing this curly braces
53                {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name':# You are missing name parameter here; Also C3 open; You are not closing this curly braces
54            ], #S2 closed
55
56            'layout': {                           #C4 open
57                'title': 'Dash Data Visualization'
58            }                                     # C4 closed
59        } # C1 closed
60    ) # P4 closed
61])#S1 closed, P1 closed
62
63if __name__ == '__main__':
64    app.run_server(debug=True) # this need to be indented
65

Source https://stackoverflow.com/questions/71626452

QUESTION

Get the request header in Plotly Dash running in gunicorn

Asked 2022-Feb-01 at 08:20

This is related to this post but the solution does not work.

I have SSO auth passing in a request header with a username. In a Flask app I can get the username back using flask.request.headers['username']. In Dash I get a server error. Here is the Dash app - it is using gunicorn.

1import dash
2from dash import html
3import plotly.graph_objects as go
4from dash import dcc
5
6from dash.dependencies import Input, Output
7import flask
8from flask import request
9
10server = flask.Flask(__name__) # define flask app.server
11
12app = dash.Dash(__name__, serve_locally=False, server=server)
13
14username = request.headers['username']
15greeting = &quot;Hello &quot; + username
16
17app.layout = html.Div(children=[
18    html.H1(children=greeting),
19
20    html.Div(children='''
21            Dash: A web application framework for Python.
22        '''),
23
24    dcc.Graph(
25            id='example-graph',
26            figure={
27                'data': [
28                    {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
29                    {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
30                ],
31                'layout': {
32                    'title': 'Dash Data Visualization'
33                }
34            }
35        )
36])
37
38if __name__ == '__main__':
39    app.run_server()
40
41
42

Any help would be much appreciated.

ANSWER

Answered 2022-Feb-01 at 08:20

You can only access the request object from within a request context. In Dash terminology that means from within a callback. Here is a small example,

1import dash
2from dash import html
3import plotly.graph_objects as go
4from dash import dcc
5
6from dash.dependencies import Input, Output
7import flask
8from flask import request
9
10server = flask.Flask(__name__) # define flask app.server
11
12app = dash.Dash(__name__, serve_locally=False, server=server)
13
14username = request.headers['username']
15greeting = &quot;Hello &quot; + username
16
17app.layout = html.Div(children=[
18    html.H1(children=greeting),
19
20    html.Div(children='''
21            Dash: A web application framework for Python.
22        '''),
23
24    dcc.Graph(
25            id='example-graph',
26            figure={
27                'data': [
28                    {'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
29                    {'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
30                ],
31                'layout': {
32                    'title': 'Dash Data Visualization'
33                }
34            }
35        )
36])
37
38if __name__ == '__main__':
39    app.run_server()
40
41
42from dash import html, Input, Output, Dash
43from flask import request
44
45app = Dash(__name__)
46app.layout = html.Div(children=[
47    html.Div(id=&quot;greeting&quot;),
48    html.Div(id=&quot;dummy&quot;)  # dummy element to trigger callback on page load
49])
50
51
52@app.callback(Output(&quot;greeting&quot;, &quot;children&quot;), Input(&quot;dummy&quot;, &quot;children&quot;))
53def say_hello(_):
54    host = request.headers['host']  # host should always be there
55    return f&quot;Hello from {host}!&quot;
56
57
58if __name__ == '__main__':
59    app.run_server()
60

Source https://stackoverflow.com/questions/70935643

QUESTION

How to compile 64-bit libraries for qwt-6.1.2 on Windows with command line

Asked 2021-Dec-21 at 14:34

We are using Visual Studio 2019, Qt5.12.3 and qwt-6.1.2 (Qwt is a graphics extension to the Qt GUI application framework) on Windows 10. Our solution has traditionally been a 32-bit only application, but we've received a request to deliver it in both 32-bit and 64-bit.

My question is specifically related to 64-bit qwt-6.1.2.

The 32-bit version of qwt-6.1.2 is compiled without problems with the following script that runs in a batch file (no, we cannot use power shell because power shell scripts are disabled on our network).

1cd\resources
2tar -xf qwt-6.1.2.zip
3rem del qwt-6.1.2.zip
4cd\resources\qwt-6.1.2
5
6REM Add the x86 path to compile qwt-6.1.2
7SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;
8
9REM Create qwt make files
10REM 1. Set up x86 environment
11&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat&quot;
12REM 2. Create x86 make files
13qmake qwt.pro
14REM 3. Compile the binaries for x86 version of qwt-6.1.2
15nmake
16

When trying to compile the same source in 64-bit using the script below I receive hundreds of linker errors

1cd\resources
2tar -xf qwt-6.1.2.zip
3rem del qwt-6.1.2.zip
4cd\resources\qwt-6.1.2
5
6REM Add the x86 path to compile qwt-6.1.2
7SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;
8
9REM Create qwt make files
10REM 1. Set up x86 environment
11&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat&quot;
12REM 2. Create x86 make files
13qmake qwt.pro
14REM 3. Compile the binaries for x86 version of qwt-6.1.2
15nmake
16REM Add the x64 path to compile qwt-6.1.2
17SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin
18
19REM Create qwt make files
20REM 1. Set up x64 environment
21&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat&quot;
22REM 2. Clean up the old qmake data for rebuild to x64
23del c:\resources\qwt-6.1.2\.qmake.stash
24del c:\resources\qwt-6.1.2\Makefile
25REM 3. Create x86 make files
26qmake qwt.pro
27REM 4. Compile the binaries for x86 version of qwt-6.1.2
28nmake
29
1cd\resources
2tar -xf qwt-6.1.2.zip
3rem del qwt-6.1.2.zip
4cd\resources\qwt-6.1.2
5
6REM Add the x86 path to compile qwt-6.1.2
7SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;
8
9REM Create qwt make files
10REM 1. Set up x86 environment
11&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat&quot;
12REM 2. Create x86 make files
13qmake qwt.pro
14REM 3. Compile the binaries for x86 version of qwt-6.1.2
15nmake
16REM Add the x64 path to compile qwt-6.1.2
17SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin
18
19REM Create qwt make files
20REM 1. Set up x64 environment
21&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat&quot;
22REM 2. Clean up the old qmake data for rebuild to x64
23del c:\resources\qwt-6.1.2\.qmake.stash
24del c:\resources\qwt-6.1.2\Makefile
25REM 3. Create x86 make files
26qmake qwt.pro
27REM 4. Compile the binaries for x86 version of qwt-6.1.2
28nmake
29linking ..\lib\qwt.dll
30   Creating library ..\lib\qwt.lib and object ..\lib\qwt.exp
31qwt_dial.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
32qwt_knob.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
33qwt_slider.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
34qwt_thermo.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
35qwt_abstract_slider.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
36qwt_abstract_scale.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
37qwt_analog_clock.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
38qwt_compass.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
39

etc. etc... ending with

1cd\resources
2tar -xf qwt-6.1.2.zip
3rem del qwt-6.1.2.zip
4cd\resources\qwt-6.1.2
5
6REM Add the x86 path to compile qwt-6.1.2
7SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;
8
9REM Create qwt make files
10REM 1. Set up x86 environment
11&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat&quot;
12REM 2. Create x86 make files
13qmake qwt.pro
14REM 3. Compile the binaries for x86 version of qwt-6.1.2
15nmake
16REM Add the x64 path to compile qwt-6.1.2
17SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin
18
19REM Create qwt make files
20REM 1. Set up x64 environment
21&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat&quot;
22REM 2. Clean up the old qmake data for rebuild to x64
23del c:\resources\qwt-6.1.2\.qmake.stash
24del c:\resources\qwt-6.1.2\Makefile
25REM 3. Create x86 make files
26qmake qwt.pro
27REM 4. Compile the binaries for x86 version of qwt-6.1.2
28nmake
29linking ..\lib\qwt.dll
30   Creating library ..\lib\qwt.lib and object ..\lib\qwt.exp
31qwt_dial.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
32qwt_knob.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
33qwt_slider.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
34qwt_thermo.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
35qwt_abstract_slider.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
36qwt_abstract_scale.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
37qwt_analog_clock.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
38qwt_compass.obj : error LNK2001: unresolved external symbol &quot;void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))&quot; (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
39LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
40LINK : error LNK2001: unresolved external symbol __load_config_used
41C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64\msvcprt.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
42C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64\MSVCRT.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
43C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64\uuid.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
44..\lib\qwt.dll : fatal error LNK1120: 47 unresolved externals
45NMAKE : fatal error U1077: 'echo' : return code '0x460'
46Stop.
47NMAKE : fatal error U1077: '&quot;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe&quot;' : return code '0x2'
48Stop.
49NMAKE : fatal error U1077: 'cd' : return code '0x2'
50Stop.
51

It appears that somewhere, something is referencing some 32-bit libraries, but I can't find any documentation (I've been searching for a few days) that specifically deal with compiling a 64-bit version of qwt-6.1.2 (or any of the related qwt versions) on Windows.

Any guidance in finding the 64-bit sources, or instructions on how to compile for 64-bit would be greatly appreciated.

ANSWER

Answered 2021-Dec-20 at 22:29

You are missing a call to nmake clean and so there are (even after a fresh qmake) leftovers from the 32bit-build breaking your 64bit-build.

Source https://stackoverflow.com/questions/70426230

QUESTION

WinForms Startup Event not being handled

Asked 2021-Dec-09 at 13:23

I have a Windows Forms Application in .NET 5 with Application Framework activated and the startup object set to (my) MainForm.
Using "View Application Events" in the application's properties, I auto-generated the ApplicationEvents.vb file and with the given controls auto-generated a method to do something on Startup (as I understand before even the MainForm loads) - but nothing in this method gets run, not even breakpoints are triggered.
I would assume an auto-generated sub in an auto-generated file designed for this should work and every other event handling sub does, just not Startup's.

This is my ApplicationEvents.vb (without the auto-generated comment):

1Imports Microsoft.VisualBasic.ApplicationServices
2
3Namespace My
4    Partial Friend Class MyApplication
5        Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
6            Debug.Print(&quot;Test&quot;)
7            MsgBox(&quot;Test&quot;)
8        End Sub
9    End Class
10End Namespace
11
Background:

I'm trying to enable high DPI scaling for my application.
For this I've tried using the app.manifest file (opened by "View Windows Settings" in the application's properties), but no combination of tags I found in the docs worked (I'm running the required version of Windows 10 of cause). The same for the app.config file, but I expected this because it's a .NET Framework feature to use it for that.
So I landed on Application.SetHighDpiMode(HighDpiMode). This worked when put into the MainForm's Loadevent, but it only did what was intended when the form was already loaded and it was then put on a scaled up screen / the screen was scaled up while it was already loaded. If it was started on an already scaled screen, it looked jumbled.
So I figured that enabling it only on the form loading is just a bit too late and it should be run asap, so I landed on Startup.

ANSWER

Answered 2021-Dec-09 at 13:23

The startup object has to be Sub Main for the Startup event to work, not MainForm (or any form at all).
(Thanks to @Hans Passant for the tip.)

If you want to change which one is the main form later on you have to do the following:

  1. Close your project in Visual Studio.
  2. Open your project's folder in explorer.
  3. In it, open folder My Project.
  4. Open Application.myapp with any text editor.
  5. Change the form between the <MainForm> tags to your (new) main forms name.
  6. Save and close.
  7. Open ApplicationDesigner.vb with any text editor.
  8. Find the following line and change YourMainFormsName to your (new) main forms name:
1Imports Microsoft.VisualBasic.ApplicationServices
2
3Namespace My
4    Partial Friend Class MyApplication
5        Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
6            Debug.Print(&quot;Test&quot;)
7            MsgBox(&quot;Test&quot;)
8        End Sub
9    End Class
10End Namespace
11Protected Overrides Sub OnCreateMainForm()
12    Me.MainForm = Global.YourProjectsName.YourMainFormsName
13End Sub
14
  1. Save and close.
  2. Open your project again and start it up. The startup form should have changed.

This way you can keep the application framework and don't have to write your own Sub Main.

Source https://stackoverflow.com/questions/70287525

QUESTION

Creating a Custom Android ROM

Asked 2021-Nov-27 at 21:06

I am preparing to build a custom Android ROM and I have come across some misunderstandings that I need clarified before moving forward. My Android ROM will be rebranded and I would like to customize the OS stack but I am not sure I fully understand the concept of HAL(Hardware abstraction layer). I understand that I can create kernel modules to extend the OS but I am not sure what the HAL purpose is within the stack. How does the HAL and the kernel interact if at all?

What is the HAL? When is the HAL implemented?

Another layer of the stack I am looking at is the Android System Services layer. Would it be possible to add / modify a system service on the stack? If so, would I need to create a Binder IPC for the System Service to be called from the application framework?

I have read the documentation from the AOSP website but that is where my misunderstandings is coming from.

If anyone can help me overcome these shortcomings I would greatly appreciate it!

ANSWER

Answered 2021-Nov-27 at 21:06

Ok, so I can answer your question about HAL but not so much about messing with Android services.

HAL is basically all of the files in the /dev directory on Linux systems. These files communicate with the kernel module/driver when you write to it. This basically, if the driver of the certain device you want to write to allows it, allows you to communicate with the device from a very high level point. Take a look into basic tutorials about writing kernel modules and udev. In the case of building Android though, you probably won't have to mess around with this and know it through and through unless you are making custom kernels and stuff.

Source https://stackoverflow.com/questions/70011918

QUESTION

java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage when starting Spring 5.0.7.RELEASE app. in Weblogic

Asked 2021-Oct-14 at 15:19

I have this error when deploying a Spring application framework , and I chech the app and the class is in the classpath

it happens on the line: <jpa:repositories base-package="com.sala.repositories"/>

1Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [com/sala/services/pluginConfig.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage
2    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)
3    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
4    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
5    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
6    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:223)
7    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:233)
8    ... 66 common frames omitted
9Caused by: java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage
10    at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:132)
11    at org.springframework.data.repository.config.RepositoryBeanDefinitionParser.parse(RepositoryBeanDefinitionParser.java:78)
12    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
13    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1366)
14    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1352)
15    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:178)
16    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:148)
17    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:98)
18    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
19    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
20    ... 71 common frames omitted
21

the file:

1Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [com/sala/services/pluginConfig.xml]; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage
2    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)
3    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
4    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
5    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
6    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:223)
7    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:233)
8    ... 66 common frames omitted
9Caused by: java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage
10    at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:132)
11    at org.springframework.data.repository.config.RepositoryBeanDefinitionParser.parse(RepositoryBeanDefinitionParser.java:78)
12    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
13    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1366)
14    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1352)
15    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:178)
16    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:148)
17    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:98)
18    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
19    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
20    ... 71 common frames omitted
21&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
22       xmlns:context=&quot;http://www.springframework.org/schema/context&quot;
23       xmlns:jpa=&quot;http://www.springframework.org/schema/data/jpa&quot; xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot;
24       xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
25       xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;
26       xsi:schemaLocation=&quot;
27        http://www.springframework.org/schema/data/jpa
28        http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
29        http://www.springframework.org/schema/beans
30        http://www.springframework.org/schema/beans/spring-beans.xsd
31        http://www.springframework.org/schema/context
32        http://www.springframework.org/schema/context/spring-context.xsd
33        http://www.springframework.org/schema/jee
34        http://www.springframework.org/schema/jee/spring-jee.xsd
35        http://www.springframework.org/schema/tx
36        http://www.springframework.org/schema/tx/spring-tx.xsd
37        http://www.springframework.org/schema/aop 
38        http://www.springframework.org/schema/aop/spring-aop.xsd&quot;&gt;
39    
40    
41
42    &lt;jpa:repositories base-package=&quot;com.sala.repositories&quot;/&gt;
43
44    
45    
46   
47&lt;/beans&gt;
48

ANSWER

Answered 2021-Aug-19 at 08:38

it was some conflict in the pom.xml dependencies

Source https://stackoverflow.com/questions/68843734

QUESTION

Storing GET request parameters when initialising Open IDC auth dance for use after

Asked 2021-Oct-05 at 19:34

We are implementing Keycloak as an IDP, and will use it to secure some apps (Relying Parties)

The apps are likely to use something like mod_auth_openidc, which will use the Authorization Code flow to direct the user to keycloak where the user will log in, do the openidc dance, and ultimately end up back at the "redirect_uri".

We will be calling the applications with a set of parameters, lets say for example: https://some-application/launch?person=12345

The redirect_uri is going to be https://some-application/launch, as I understand the Oauth2 spec is quite specific that the redirect_uri should be static, and not contain parameters/be dynamic.

So this means following login the request parameter "person=12345" is lost, as the user is simply redirected back to "https://some-application/launch"

What is the recommended pattern/approach to persist this "person=12345" request parameter before the OIDC dance takes place?

I have read about the "state" parameter, but I am unclear how we would inject anything into this with mod_auth_openidc, or how we would read any values from it? Is it more of an application framework question - would some kind of controller/server side code (PHP/c# etc) somehow store these values in session (but I am unclear if they would have a chance to before mod_auth_openidc kicked in?

ANSWER

Answered 2021-Oct-05 at 19:34

It is an application responsibility to store the location before redirecting and to restore it afterwards:

  • Single Page Apps can manage this via session storage as in this code of mine since they are in control of behaviour before and after

  • Server Side Web Apps may give you similar options, to store the location in an HTTP only cookie, then restore it after, but you need to check for the particular tech being used. It is a well known usability issue that abrupt redirects may occur that the UI cannot control, and that deep linking (as you described) may not work.

You need an application design to solve this problem. Out of interest my recent blog post mentions this issue.

Source https://stackoverflow.com/questions/69454036

QUESTION

Symfony 4.4 Auth0 how to completely logout user from the application

Asked 2021-Aug-26 at 06:58
Basic info:

I created a test application to test if SSO (Single sign on) works. I use Auth0 as a SSO provider. Symfony 4.4 as application framework. I used this article from Auth0 to create the basics. So far I can login/logout.

Problem:

When I login once (with credentials), logout after and then login again I am instandly logged in with the same account I used before. Without needing to fill in credentials again. It seems to remember the session or somehow does not completely logout a user. I want the user to have to login again with credentials after it logged out. Since some of my users will use one computer for the applications (so switching user is needed).

Possible fix/Extra info:

According to there docs/community I should look at this. But this seems to mean that I need API calls to add the ?federated. Which the setup example does not use (probably the library does it for me). Also my logout function in the SecurityController that is generated by the make:auth (or make:user) doesn't execute the code anymore. Even if I change the function name it still logged me out. Only untill I remove/change the route name it stops. It's probably very bad but maybe if I had the chance to execute a API call when I logout I could do this API call.

The best thing I could imagine to do is change some settings in symfony or add some small piece of code to make it logout correclty. But I dont know how.

My code:

SecurityController.php

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39

Auth0ResourceOwner.php

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89

routes.yaml

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107

hwi_oauth.yaml

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118

security.yaml

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160

.env

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160AUTH0_CLIENT_ID=not-so-secret-but-secret
161AUTH0_CLIENT_SECRET=secret
162AUTH0_DOMAIN=dev-...
163

Dump of user:

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160AUTH0_CLIENT_ID=not-so-secret-but-secret
161AUTH0_CLIENT_SECRET=secret
162AUTH0_DOMAIN=dev-...
163TestPageController.php on line 17:
164HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUser {#3742 ▼
165  #username: &quot;testUser&quot;
166}
167

I hope it's understandable. Any help is appreciated.

ANSWER

Answered 2021-Aug-26 at 06:58

It looks like that you have to logout from the oauth service you are using, here is a similar issue.

Worked out in code:

src/Security/CustomLogoutSuccessHandler.php

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160AUTH0_CLIENT_ID=not-so-secret-but-secret
161AUTH0_CLIENT_SECRET=secret
162AUTH0_DOMAIN=dev-...
163TestPageController.php on line 17:
164HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUser {#3742 ▼
165  #username: &quot;testUser&quot;
166}
167&lt;?php
168
169namespace App\Security;
170
171use Symfony\Component\HttpFoundation\Request;
172use Symfony\Component\HttpFoundation\RedirectResponse;
173use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
174
175class CustomLogoutSuccessHandler implements LogoutSuccessHandlerInterface
176{
177    private $target;
178
179    public function __construct(string $target)
180    {
181        $this-&gt;target = $target;
182    }
183
184    public function onLogoutSuccess(Request $request)
185    {
186        return new RedirectResponse($this-&gt;target);
187    }
188}
189

security.yaml

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160AUTH0_CLIENT_ID=not-so-secret-but-secret
161AUTH0_CLIENT_SECRET=secret
162AUTH0_DOMAIN=dev-...
163TestPageController.php on line 17:
164HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUser {#3742 ▼
165  #username: &quot;testUser&quot;
166}
167&lt;?php
168
169namespace App\Security;
170
171use Symfony\Component\HttpFoundation\Request;
172use Symfony\Component\HttpFoundation\RedirectResponse;
173use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
174
175class CustomLogoutSuccessHandler implements LogoutSuccessHandlerInterface
176{
177    private $target;
178
179    public function __construct(string $target)
180    {
181        $this-&gt;target = $target;
182    }
183
184    public function onLogoutSuccess(Request $request)
185    {
186        return new RedirectResponse($this-&gt;target);
187    }
188}
189logout:
190   path: /logout
191   success_handler: App\Security\CustomLogoutSuccessHandler
192

services.yaml

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160AUTH0_CLIENT_ID=not-so-secret-but-secret
161AUTH0_CLIENT_SECRET=secret
162AUTH0_DOMAIN=dev-...
163TestPageController.php on line 17:
164HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUser {#3742 ▼
165  #username: &quot;testUser&quot;
166}
167&lt;?php
168
169namespace App\Security;
170
171use Symfony\Component\HttpFoundation\Request;
172use Symfony\Component\HttpFoundation\RedirectResponse;
173use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
174
175class CustomLogoutSuccessHandler implements LogoutSuccessHandlerInterface
176{
177    private $target;
178
179    public function __construct(string $target)
180    {
181        $this-&gt;target = $target;
182    }
183
184    public function onLogoutSuccess(Request $request)
185    {
186        return new RedirectResponse($this-&gt;target);
187    }
188}
189logout:
190   path: /logout
191   success_handler: App\Security\CustomLogoutSuccessHandler
192services:
193   App\Security\CustomLogoutSuccessHandler:
194       arguments: ['%env(resolve:LOGOUT_TARGET_URL)%']
195

.env

1&lt;?php
2
3namespace App\Controller;
4
5use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6use Symfony\Component\HttpFoundation\Response;
7use Symfony\Component\Routing\Annotation\Route;
8use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
9
10class SecurityController extends AbstractController
11{
12    /**
13     * @Route(&quot;/login&quot;, name=&quot;app_login&quot;)
14     */
15    public function login(AuthenticationUtils $authenticationUtils): Response
16    {
17        // get the login error if there is one
18        $error = $authenticationUtils-&gt;getLastAuthenticationError();
19
20        // last username entered by the user
21        $lastUsername = $authenticationUtils-&gt;getLastUsername();
22
23        return $this-&gt;render('security/login.html.twig', ['last_username' =&gt; $lastUsername, 'error' =&gt; $error]);
24    }
25
26    /**
27     * @Route(&quot;/logout&quot;, name=&quot;app_logout&quot;)
28     */
29    public function logout()
30    {
31        // Does not trigger at all. It does not stop the page but just continues to redirect and logout.
32        dump($this-&gt;get('session'));
33        dump($session);
34        dump(&quot;test&quot;);
35        exit();
36        throw new \Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
37    }
38}
39&lt;?php
40
41namespace App;
42
43use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\GenericOAuth2ResourceOwner;
44use Symfony\Component\OptionsResolver\Options;
45use Symfony\Component\OptionsResolver\OptionsResolver;
46
47class Auth0ResourceOwner extends GenericOAuth2ResourceOwner
48{
49    protected $paths = array(
50        'identifier' =&gt; 'user_id',
51        'nickname' =&gt; 'nickname',
52        'realname' =&gt; 'name',
53        'email' =&gt; 'email',
54        'profilepicture' =&gt; 'picture',
55    );
56
57    public function getAuthorizationUrl($redirectUri, array $extraParameters = array())
58    {
59        return parent::getAuthorizationUrl($redirectUri, array_merge(array(
60            'audience' =&gt; $this-&gt;options['audience'],
61        ), $extraParameters));
62    }
63
64    protected function configureOptions(OptionsResolver $resolver)
65    {
66        parent::configureOptions($resolver);
67
68        $resolver-&gt;setDefaults(array(
69            'authorization_url' =&gt; '{base_url}/authorize',
70            'access_token_url' =&gt; '{base_url}/oauth/token',
71            'infos_url' =&gt; '{base_url}/userinfo',
72            'audience' =&gt; '{base_url}/userinfo',
73        ));
74
75        $resolver-&gt;setRequired(array(
76            'base_url',
77        ));
78
79        $normalizer = function (Options $options, $value) {
80            return str_replace('{base_url}', $options['base_url'], $value);
81        };
82
83        $resolver-&gt;setNormalizer('authorization_url', $normalizer);
84        $resolver-&gt;setNormalizer('access_token_url', $normalizer);
85        $resolver-&gt;setNormalizer('infos_url', $normalizer);
86        $resolver-&gt;setNormalizer('audience', $normalizer);
87    }
88}
89hwi_oauth_redirect:
90  resource: &quot;@HWIOAuthBundle/Resources/config/routing/redirect.xml&quot;
91  prefix: /connect
92
93hwi_oauth_connect:
94  resource: &quot;@HWIOAuthBundle/Resources/config/routing/connect.xml&quot;
95  prefix: /connect
96
97hwi_oauth_login:
98  resource: &quot;@HWIOAuthBundle/Resources/config/routing/login.xml&quot;
99  prefix: /login
100
101auth0_login:
102  path: /auth0/callback
103
104auth0_logout:
105  path: /auth0/logout
106  # controller: App/Controller/SecurityController::logout
107hwi_oauth:
108  firewall_names: [main]
109  # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
110  resource_owners:
111    auth0:
112      type: oauth2
113      class: 'App\Auth0ResourceOwner'
114      client_id: &quot;%env(AUTH0_CLIENT_ID)%&quot;
115      client_secret: &quot;%env(AUTH0_CLIENT_SECRET)%&quot;
116      base_url: &quot;https://%env(AUTH0_DOMAIN)%&quot;
117      scope: &quot;openid profile email&quot;
118security:
119    encoders:
120        App\Entity\Users:
121            algorithm: auto
122
123    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
124    providers:
125        # used to reload user from session &amp; other features (e.g. switch_user)
126        app_user_provider:
127            entity:
128                class: App\Entity\Users
129                property: username
130        oauth_hwi:
131            id: hwi_oauth.user.provider
132        # used to reload user from session &amp; other features (e.g. switch_user)
133    firewalls:
134        dev:
135            pattern: ^/(_(profiler|wdt)|css|images|js)/
136            security: false
137        main:
138            anonymous: ~
139            provider: oauth_hwi
140            oauth:
141                resource_owners:
142                    auth0: &quot;/auth0/callback&quot;
143                login_path: /login
144                failure_path: /login
145                default_target_path: /testPage
146                oauth_user_provider:
147                    service: hwi_oauth.user.provider
148            guard:
149                authenticators:
150                    - App\Security\LoginFormAuthenticator
151            logout:
152                path: /logout
153                # target: /login
154
155    access_control:
156        - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
157
158        # Everyone that logged in can go to /
159        - { path: '^/testPage', roles: [IS_AUTHENTICATED_FULLY] }
160AUTH0_CLIENT_ID=not-so-secret-but-secret
161AUTH0_CLIENT_SECRET=secret
162AUTH0_DOMAIN=dev-...
163TestPageController.php on line 17:
164HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUser {#3742 ▼
165  #username: &quot;testUser&quot;
166}
167&lt;?php
168
169namespace App\Security;
170
171use Symfony\Component\HttpFoundation\Request;
172use Symfony\Component\HttpFoundation\RedirectResponse;
173use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
174
175class CustomLogoutSuccessHandler implements LogoutSuccessHandlerInterface
176{
177    private $target;
178
179    public function __construct(string $target)
180    {
181        $this-&gt;target = $target;
182    }
183
184    public function onLogoutSuccess(Request $request)
185    {
186        return new RedirectResponse($this-&gt;target);
187    }
188}
189logout:
190   path: /logout
191   success_handler: App\Security\CustomLogoutSuccessHandler
192services:
193   App\Security\CustomLogoutSuccessHandler:
194       arguments: ['%env(resolve:LOGOUT_TARGET_URL)%']
195LOGOUT_TARGET_URL=https://{yourAuth0AppDomain}.auth0.com/v2/logout?returnTo={yourRedirectURL}&amp;client_id={secret}
196

Using code from the Github issue redirects you 4 times. Logout->Route->(.env)Auth0->Route.

Using code shown above redirects you 3 times. Logout->Auth0->Route. Just a small improvement.

Code from this post.

Source https://stackoverflow.com/questions/68859855

QUESTION

How to display blog post with HTML code snippets in Laravel

Asked 2021-Aug-24 at 15:45

My blog posts are saved in a DB in text format and I can't find the way of displaying HTML code between the paragraphs as you can see in the image below.

I'm using Prismjs and <pre><code></code></pre> tags..

enter image description here

Inside the code block there should be two <div> tags which are not displayed.

Looks like this in the database table

1Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.
2
3Laravel strives to provide an amazing developer experience while providing powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.
4
5Whether you are new to PHP or web frameworks or have years of experience, Laravel is a framework that can grow with you. We'll help you take your first steps as a web developer or give you a boost as you take your expertise to the next level. We can't wait to see what you build.
6
7&lt;pre&gt;&lt;code class=&quot;lang-html&quot;&gt;
8&lt;div&gt;test&lt;/div&gt;
9&lt;/code&gt;&lt;/pre&gt;
10

In my post_body.blade.php view I'm using {!! nl2br($post->body) !!} to display the content of the post.

If I use <pre><code class="lang-html">{{ $post->body }}</code></pre> on the blade view the code is visible but I have no way of including the text of the post. It would only work to show code.

I'm facing the problem of not been able to do both things, is one or the other.

ANSWER

Answered 2021-Aug-24 at 15:45

There is no straightforward way of doing this by using standard Laravel/Blade output options. However it's possible to accomplish it with a little bit of extra code.

1. Why is this happening

Neither <pre> or <code> is stopping the browser to interpret the text inside as html code. They have different purpose: one is to tell the browser that the whitespaces are important and the other to tell that the content is some computer code and needs to be shown with different styling. In both cases if valid HTML code is inside the tags it will be treated as HTML.

By the way it's mentioned in Prism documentation that you need to escape the content:

Note: You have to escape all < and & characters inside < code > elements (code blocks and inline snippets) with < and & respectively, or else the browser might interpret them as an HTML tag or entity. If you have large portions of HTML code, you can use the Unescaped Markup plugin to work around this.

2. Solutions

There are different ways of solving your issue. You can either modify the input before saving it to the database and then just print the unescaped contents or modify the output and make sure you have escaped only the text in the <code> tag.

Because we don't know much about the input method you use let's focus on the second option to modify the output.

A. PrismJS

Their documentation points to a solution where you can use the Unescaped markup plugin to solve your issue. I don't have any experience with it, but the slogan says "Write markup without having to escape anything.", so it seems it will do the work.

You only need to include the plugin and then you have two options: to swap <pre><code> for <script> or to use HTML-comment to wrap your code (if you don't have other comments in the code

Just look at their examples for detailed information

B. PHP

You can use PHP to parse the text from the database and escape the content of the needed elements. In your case this is the code element. You will need to write your own implementation or use the one that I wrote for your case.

Then you can just do:

1Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.
2
3Laravel strives to provide an amazing developer experience while providing powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.
4
5Whether you are new to PHP or web frameworks or have years of experience, Laravel is a framework that can grow with you. We'll help you take your first steps as a web developer or give you a boost as you take your expertise to the next level. We can't wait to see what you build.
6
7&lt;pre&gt;&lt;code class=&quot;lang-html&quot;&gt;
8&lt;div&gt;test&lt;/div&gt;
9&lt;/code&gt;&lt;/pre&gt;
10{!! Houdini::escape($content) !!}
11

Include or autoload the following class:

1Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.
2
3Laravel strives to provide an amazing developer experience while providing powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.
4
5Whether you are new to PHP or web frameworks or have years of experience, Laravel is a framework that can grow with you. We'll help you take your first steps as a web developer or give you a boost as you take your expertise to the next level. We can't wait to see what you build.
6
7&lt;pre&gt;&lt;code class=&quot;lang-html&quot;&gt;
8&lt;div&gt;test&lt;/div&gt;
9&lt;/code&gt;&lt;/pre&gt;
10{!! Houdini::escape($content) !!}
11class Houdini
12{
13    /**
14     * Escape the html characters inside a given HTML element
15     *
16     * @param string $text The text we are trying to clean
17     * @param string $element The name of the elements to be escaped
18     * @param bool $fix Should we try to make the text a valid HTML by wrapping it with divs
19     *
20     * @return string
21     */
22    public static function escape($text, $element = 'code', $fix = true) {
23        $dom = new DOMDocument;
24        $dom-&gt;loadXML($fix ? '&lt;div&gt;' . $text . '&lt;/div&gt;' : $text);
25
26        $nodes = $dom-&gt;getElementsByTagName($element);
27        foreach ($nodes as $node) {
28            $content = '';
29            foreach ($node-&gt;childNodes as $child) {
30                $content .= self::escapeRecursively($child);
31            }
32            $node-&gt;nodeValue = htmlspecialchars($content);
33        }
34        return $dom-&gt;saveHTML();
35    }
36
37    /**
38     * Escape node and note contents
39     *
40     * @param $node
41     * @return string
42     */
43    protected static function escapeRecursively($node) {
44        if ($node instanceof DOMText)
45            return $node-&gt;textContent;
46
47        $content = &quot;&lt;$node-&gt;nodeName&gt;&quot;;
48        foreach ($node-&gt;childNodes as $child) {
49            $content .= self::escapeRecursively($child);
50        }
51
52        return &quot;$content&lt;/$node-&gt;nodeName&gt;&quot;;
53    }
54}
55

C. JavaScript

You can include the following javascript code which will loop trough all the <code> elements and set the innerHtml as the innerText.

1Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.
2
3Laravel strives to provide an amazing developer experience while providing powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.
4
5Whether you are new to PHP or web frameworks or have years of experience, Laravel is a framework that can grow with you. We'll help you take your first steps as a web developer or give you a boost as you take your expertise to the next level. We can't wait to see what you build.
6
7&lt;pre&gt;&lt;code class=&quot;lang-html&quot;&gt;
8&lt;div&gt;test&lt;/div&gt;
9&lt;/code&gt;&lt;/pre&gt;
10{!! Houdini::escape($content) !!}
11class Houdini
12{
13    /**
14     * Escape the html characters inside a given HTML element
15     *
16     * @param string $text The text we are trying to clean
17     * @param string $element The name of the elements to be escaped
18     * @param bool $fix Should we try to make the text a valid HTML by wrapping it with divs
19     *
20     * @return string
21     */
22    public static function escape($text, $element = 'code', $fix = true) {
23        $dom = new DOMDocument;
24        $dom-&gt;loadXML($fix ? '&lt;div&gt;' . $text . '&lt;/div&gt;' : $text);
25
26        $nodes = $dom-&gt;getElementsByTagName($element);
27        foreach ($nodes as $node) {
28            $content = '';
29            foreach ($node-&gt;childNodes as $child) {
30                $content .= self::escapeRecursively($child);
31            }
32            $node-&gt;nodeValue = htmlspecialchars($content);
33        }
34        return $dom-&gt;saveHTML();
35    }
36
37    /**
38     * Escape node and note contents
39     *
40     * @param $node
41     * @return string
42     */
43    protected static function escapeRecursively($node) {
44        if ($node instanceof DOMText)
45            return $node-&gt;textContent;
46
47        $content = &quot;&lt;$node-&gt;nodeName&gt;&quot;;
48        foreach ($node-&gt;childNodes as $child) {
49            $content .= self::escapeRecursively($child);
50        }
51
52        return &quot;$content&lt;/$node-&gt;nodeName&gt;&quot;;
53    }
54}
55    document.querySelectorAll(&quot;code&quot;).forEach(el =&gt; el.innerText = el.innerHTML);
56

Note: If you keep the paragraphs in the database separated only with new lines and not wrapped in <p> you will have issues using this solution and nl2br() together.

D. Deprecated <xmp>

1Laravel is a web application framework with expressive, elegant syntax. A web framework provides a structure and starting point for creating your application, allowing you to focus on creating something amazing while we sweat the details.
2
3Laravel strives to provide an amazing developer experience while providing powerful features such as thorough dependency injection, an expressive database abstraction layer, queues and scheduled jobs, unit and integration testing, and more.
4
5Whether you are new to PHP or web frameworks or have years of experience, Laravel is a framework that can grow with you. We'll help you take your first steps as a web developer or give you a boost as you take your expertise to the next level. We can't wait to see what you build.
6
7&lt;pre&gt;&lt;code class=&quot;lang-html&quot;&gt;
8&lt;div&gt;test&lt;/div&gt;
9&lt;/code&gt;&lt;/pre&gt;
10{!! Houdini::escape($content) !!}
11class Houdini
12{
13    /**
14     * Escape the html characters inside a given HTML element
15     *
16     * @param string $text The text we are trying to clean
17     * @param string $element The name of the elements to be escaped
18     * @param bool $fix Should we try to make the text a valid HTML by wrapping it with divs
19     *
20     * @return string
21     */
22    public static function escape($text, $element = 'code', $fix = true) {
23        $dom = new DOMDocument;
24        $dom-&gt;loadXML($fix ? '&lt;div&gt;' . $text . '&lt;/div&gt;' : $text);
25
26        $nodes = $dom-&gt;getElementsByTagName($element);
27        foreach ($nodes as $node) {
28            $content = '';
29            foreach ($node-&gt;childNodes as $child) {
30                $content .= self::escapeRecursively($child);
31            }
32            $node-&gt;nodeValue = htmlspecialchars($content);
33        }
34        return $dom-&gt;saveHTML();
35    }
36
37    /**
38     * Escape node and note contents
39     *
40     * @param $node
41     * @return string
42     */
43    protected static function escapeRecursively($node) {
44        if ($node instanceof DOMText)
45            return $node-&gt;textContent;
46
47        $content = &quot;&lt;$node-&gt;nodeName&gt;&quot;;
48        foreach ($node-&gt;childNodes as $child) {
49            $content .= self::escapeRecursively($child);
50        }
51
52        return &quot;$content&lt;/$node-&gt;nodeName&gt;&quot;;
53    }
54}
55    document.querySelectorAll(&quot;code&quot;).forEach(el =&gt; el.innerText = el.innerHTML);
56&lt;pre&gt;&lt;code class=&quot;lang-html&quot;&gt;
57&lt;xmp&gt;&lt;div&gt;test&lt;/div&gt;&lt;/xmp&gt;
58&lt;/code&gt;&lt;/pre&gt;
59

There WAS after all an HTML tag specifically to show example HTML code as it is, but it was deprecated in HTML 3.2, BUT it seems the tag is widely supported and wrapping the code contents can be a quick and dirty solution for your case. You can see the support tables here: https://caniuse.com/?search=xmp

Read more here: https://html.com/tags/xmp/#ixzz74T0AJctF

You can accomplish this by adding the tags before saving to the database or when printing the output with JavaScript on the client side or with PHP before passing it to the blade template.

3. Other StackOverflow posts that helped me for this answer

Source https://stackoverflow.com/questions/68849173

QUESTION

How should I properly go about null errors in my code?

Asked 2021-Aug-16 at 02:22

I'm fairly new to Flutter Mobile application framework and I'm still trying understand Darts null safety. On line 11 I'm unsure on how to go about this error in my code.

~ Non-nullable instance field '_numberfrom' must be initialized. Try adding an initializer expression, or a generative constructor that initializes it or mark it late.

  • should I mark it late and would that be proper way go about initializing 'numberfrom'?

  • Line 37 I'm aswell receiving blue line on my code

Text((_numberFrom == null) ? '' : _numberFrom.toString()), ~ The operand can't be null so the condition is always false, try removing the condition, an enclosing condition, or the whole conditional statement.

Any help would be greatly appreciated thank you! I attached snippet of my code aswell, Im really looking for ideas and help to properly fix the bugs.enter image description here

ANSWER

Answered 2021-Aug-16 at 02:05

You can use the if null operator in your Text widget like this:

1Text(_numberFrom.toString() ?? 'default value') 
2

You can check more information about null-safety here

Source https://stackoverflow.com/questions/68796637

Community Discussions contain sources that include Stack Exchange Network

Tutorials and Learning Resources in Application Framework

Tutorials and Learning Resources are not available at this moment for Application Framework

Share this Page

share link

Get latest updates on Application Framework