mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-30 23:33:34 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			2145df0dfb
			...
			4e6d65645f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 4e6d65645f | ||
|  | 8434b9fce4 | ||
|  | f4bd65dd2c | ||
|  | a856c4d6e1 | ||
|  | 2f334b5f9f | 
| @@ -254,6 +254,10 @@ func (s *testsuite) TestDeleteAll() { | |||||||
| 		WithArgs(false). | 		WithArgs(false). | ||||||
| 		WillReturnResult(sqlmock.NewResult(0, 1)) | 		WillReturnResult(sqlmock.NewResult(0, 1)) | ||||||
|  |  | ||||||
|  | 	s.mock. | ||||||
|  | 		ExpectExec(regexp.QuoteMeta(`DELETE FROM "auth"`)). | ||||||
|  | 		WillReturnResult(sqlmock.NewResult(0, 1)) | ||||||
|  |  | ||||||
| 	err := DeleteAll() | 	err := DeleteAll() | ||||||
| 	require.NoError(s.T(), err) | 	require.NoError(s.T(), err) | ||||||
| 	require.NoError(s.T(), s.mock.ExpectationsWereMet()) | 	require.NoError(s.T(), s.mock.ExpectationsWereMet()) | ||||||
|   | |||||||
| @@ -89,10 +89,22 @@ func List(pageInfo model.PageInfo, filters []model.Filter, expand []string) (ent | |||||||
| // DeleteAll will do just that, and should only be used for testing purposes. | // DeleteAll will do just that, and should only be used for testing purposes. | ||||||
| func DeleteAll() error { | func DeleteAll() error { | ||||||
| 	db := database.GetDB() | 	db := database.GetDB() | ||||||
| 	result := db.Exec(fmt.Sprintf(`DELETE FROM %s WHERE is_system = ?`, database.QuoteTableName("user")), false) | 	if result := db.Exec( | ||||||
|  | 		fmt.Sprintf(`DELETE FROM %s WHERE is_system = ?`, database.QuoteTableName("user")), | ||||||
|  | 		false, | ||||||
|  | 	); result.Error != nil { | ||||||
| 		return result.Error | 		return result.Error | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if result := db.Exec( | ||||||
|  | 		fmt.Sprintf(`DELETE FROM %s`, database.QuoteTableName("auth")), | ||||||
|  | 	); result.Error != nil { | ||||||
|  | 		return result.Error | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
| // GetCapabilities gets capabilities for a user | // GetCapabilities gets capabilities for a user | ||||||
| func GetCapabilities(userID uint) ([]string, error) { | func GetCapabilities(userID uint) ([]string, error) { | ||||||
| 	capabilities := make([]string, 0) | 	capabilities := make([]string, 0) | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| @@ -44,7 +44,7 @@ services: | |||||||
|       - redis_vol:/data |       - redis_vol:/data | ||||||
|  |  | ||||||
|   authentik: |   authentik: | ||||||
|     image: ghcr.io/goauthentik/server:2024.8.3 |     image: ghcr.io/goauthentik/server:2024.10.1 | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     command: server |     command: server | ||||||
|     env_file: |     env_file: | ||||||
| @@ -54,7 +54,7 @@ services: | |||||||
|       - db-postgres |       - db-postgres | ||||||
|  |  | ||||||
|   authentik-worker: |   authentik-worker: | ||||||
|     image: ghcr.io/goauthentik/server:2024.8.3 |     image: ghcr.io/goauthentik/server:2024.10.1 | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     command: worker |     command: worker | ||||||
|     env_file: |     env_file: | ||||||
| @@ -64,11 +64,11 @@ services: | |||||||
|       - db-postgres |       - db-postgres | ||||||
|  |  | ||||||
|   authentik-ldap: |   authentik-ldap: | ||||||
|     image: ghcr.io/goauthentik/ldap |     image: ghcr.io/goauthentik/ldap:2024.10.1 | ||||||
|     environment: |     environment: | ||||||
|       AUTHENTIK_HOST: 'http://authentik:9000' |       AUTHENTIK_HOST: 'http://authentik:9000' | ||||||
|       AUTHENTIK_INSECURE: 'true' |       AUTHENTIK_INSECURE: 'true' | ||||||
|       AUTHENTIK_TOKEN: '1N7z2r5PZrNBauuyDZSnlhU4gPSih7bkooIgqbvhzBbrA1MGYyDGZmBasJqU' |       AUTHENTIK_TOKEN: 'wKYZuRcI0ETtb8vWzMCr04oNbhrQUUICy89hSpDln1OEKLjiNEuQ51044Vkp' | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|     depends_on: |     depends_on: | ||||||
|       - authentik |       - authentik | ||||||
|   | |||||||
| @@ -16,9 +16,6 @@ module.exports = defineConfig({ | |||||||
| 		}, | 		}, | ||||||
| 		env: { | 		env: { | ||||||
| 			swaggerBase: '{{baseUrl}}/api/schema', | 			swaggerBase: '{{baseUrl}}/api/schema', | ||||||
| 			authentik: 'http://authentik:9000', |  | ||||||
| 			authentikLdap: 'authentik-ldap:3389', |  | ||||||
| 			oauthRedirect: 'http://fullstack:81', |  | ||||||
| 		}, | 		}, | ||||||
| 		baseUrl: 'http://localhost:1234', | 		baseUrl: 'http://localhost:1234', | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
| @@ -7,7 +7,8 @@ module.exports = defineConfig({ | |||||||
| 	reporterOptions:       { | 	reporterOptions:       { | ||||||
| 		configFile: 'multi-reporter.json' | 		configFile: 'multi-reporter.json' | ||||||
| 	}, | 	}, | ||||||
| 	video:             false, | 	video:             true, | ||||||
|  | 	videosFolder:      'results/videos', | ||||||
| 	screenshotsFolder: 'results/screenshots', | 	screenshotsFolder: 'results/screenshots', | ||||||
| 	e2e:               { | 	e2e:               { | ||||||
| 		setupNodeEvents(on, config) { | 		setupNodeEvents(on, config) { | ||||||
| @@ -15,9 +16,7 @@ module.exports = defineConfig({ | |||||||
| 		}, | 		}, | ||||||
| 		env: { | 		env: { | ||||||
| 			swaggerBase: '{{baseUrl}}/api/schema', | 			swaggerBase: '{{baseUrl}}/api/schema', | ||||||
| 			authentik: 'http://authentik:9000', | 			skipStackCheck: 'true', | ||||||
| 			authentikLdap: 'authentik-ldap:3389', |  | ||||||
| 			oauthRedirect: 'http://npm:81', |  | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| describe('LDAP with Authentik', () => { | describe('LDAP with Authentik', () => { | ||||||
| 	let token; | 	let token; | ||||||
| 	if (Cypress.env('stack') === 'postgres') { | 	if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') { | ||||||
|  |  | ||||||
| 		before(() => { | 		before(() => { | ||||||
| 			cy.resetUsers(); | 			cy.resetUsers(); | ||||||
| @@ -14,7 +14,7 @@ describe('LDAP with Authentik', () => { | |||||||
| 					path:  '/api/settings/ldap-auth', | 					path:  '/api/settings/ldap-auth', | ||||||
| 					data:  { | 					data:  { | ||||||
| 						value: { | 						value: { | ||||||
| 							host: Cypress.env('authentik-ldap'), | 							host: 'authentik-ldap:3389', | ||||||
| 							base_dn: 'ou=users,DC=ldap,DC=goauthentik,DC=io', | 							base_dn: 'ou=users,DC=ldap,DC=goauthentik,DC=io', | ||||||
| 							user_dn: 'cn={{USERNAME}},ou=users,DC=ldap,DC=goauthentik,DC=io', | 							user_dn: 'cn={{USERNAME}},ou=users,DC=ldap,DC=goauthentik,DC=io', | ||||||
| 							email_property: 'mail', | 							email_property: 'mail', | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| describe('OAuth with Authentik', () => { | describe('OAuth with Authentik', () => { | ||||||
| 	let token; | 	let token; | ||||||
| 	if (Cypress.env('stack') === 'postgres') { | 	if (Cypress.env('skipStackCheck') === 'true' || Cypress.env('stack') === 'postgres') { | ||||||
|  |  | ||||||
| 		before(() => { | 		before(() => { | ||||||
| 			cy.resetUsers(); | 			cy.resetUsers(); | ||||||
| @@ -14,12 +14,12 @@ describe('OAuth with Authentik', () => { | |||||||
| 					path:  '/api/settings/oauth-auth', | 					path:  '/api/settings/oauth-auth', | ||||||
| 					data:  { | 					data:  { | ||||||
| 						value: { | 						value: { | ||||||
| 							client_id: 'U5gCy0ymU8OofWS4nmkAPugCbWkFkkPztap38ReD', | 							client_id: '7iO2AvuUp9JxiSVkCcjiIbQn4mHmUMBj7yU8EjqU', | ||||||
| 							client_secret: '9ZFClxwp7LzbfhIDk7k9DngQNQfwDAYqPrQMGXjFumCvQZATtXCwme20o0TnLP6uEHUkKqEFOInhxp01gVeaHCLW83iTK4PonoUnpFnXgyZAcu0H3zBxxOkVtRwACaoW', | 							client_secret: 'VUMZzaGTrmXJ8PLksyqzyZ6lrtz04VvejFhPMBP9hGZNCMrn2LLBanySs4ta7XGrDr05xexPyZT1XThaf4ubg00WqvHRVvlu4Naa1aMootNmSRx3VAk6RSslUJmGyHzq', | ||||||
| 							authorization_url: Cypress.env('authentik') + '/application/o/authorize/', | 							authorization_url: 'http://authentik:9000/application/o/authorize/', | ||||||
| 							resource_url: Cypress.env('authentik') + '/application/o/userinfo/', | 							resource_url: 'http://authentik:9000/application/o/userinfo/', | ||||||
| 							token_url: Cypress.env('authentik') + '/application/o/token/', | 							token_url: 'http://authentik:9000/application/o/token/', | ||||||
| 							logout_url: Cypress.env('authentik') + '/application/o/npm3/end-session/', | 							logout_url: 'http://authentik:9000/application/o/npm/end-session/', | ||||||
| 							identifier: 'preferred_username', | 							identifier: 'preferred_username', | ||||||
| 							scopes: [], | 							scopes: [], | ||||||
| 							auto_create_user: true | 							auto_create_user: true | ||||||
| @@ -50,16 +50,48 @@ describe('OAuth with Authentik', () => { | |||||||
|  |  | ||||||
| 		it('Should log in with OAuth', function() { | 		it('Should log in with OAuth', function() { | ||||||
| 			cy.task('backendApiGet', { | 			cy.task('backendApiGet', { | ||||||
| 				token: token, | 				path:  '/oauth/login?redirect_base=' + encodeURI(Cypress.config('baseUrl')), | ||||||
| 				path:  '/oauth/login?redirect_base=' + encodeURI(Cypress.env('oauthRedirect')), |  | ||||||
| 			}).then((data) => { | 			}).then((data) => { | ||||||
| 				expect(data).to.have.property('result'); | 				expect(data).to.have.property('result'); | ||||||
| 				cy.visit(data.result); |  | ||||||
| 				cy.get('input[name="uidField"]').type('cypress'); | 				cy.origin('http://authentik:9000', {args: data.result}, (url) => { | ||||||
| 				cy.get('button[type="submit"]').click(); | 					cy.visit(url); | ||||||
| 				cy.get('input[name="password"]').type('fqXBfUYqHvYqiwBHWW7f'); | 					cy.get('ak-flow-executor') | ||||||
| 				cy.get('button[type="submit"]').click(); | 					.shadow() | ||||||
| 				cy.url().should('match', /fullstack/) | 					.find('ak-stage-identification') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('input[name="uidField"]', { visible: true }) | ||||||
|  | 					.type('cypress'); | ||||||
|  |  | ||||||
|  | 				cy.get('ak-flow-executor') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('ak-stage-identification') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('button[type="submit"]', { visible: true }) | ||||||
|  | 					.click(); | ||||||
|  |  | ||||||
|  | 				cy.get('ak-flow-executor') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('ak-stage-password') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('input[name="password"]', { visible: true }) | ||||||
|  | 					.type('fqXBfUYqHvYqiwBHWW7f'); | ||||||
|  |  | ||||||
|  | 				cy.get('ak-flow-executor') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('ak-stage-password') | ||||||
|  | 					.shadow() | ||||||
|  | 					.find('button[type="submit"]', { visible: true }) | ||||||
|  | 					.click(); | ||||||
|  | 				}) | ||||||
|  |  | ||||||
|  | 				// we should be logged in | ||||||
|  | 				cy.get('#root p.chakra-text') | ||||||
|  | 					.first() | ||||||
|  | 					.should('have.text', 'Nginx Proxy Manager'); | ||||||
|  |  | ||||||
|  | 				// logout: | ||||||
|  | 				cy.clearLocalStorage(); | ||||||
| 			}); | 			}); | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -14,8 +14,9 @@ describe('UI Setup and Login', () => { | |||||||
| 		cy.get('input[name="password"]').type('changeme'); | 		cy.get('input[name="password"]').type('changeme'); | ||||||
| 		cy.get('form button:last').click(); | 		cy.get('form button:last').click(); | ||||||
|  |  | ||||||
| 		// To fix after chakra change: | 		cy.get('#root p.chakra-text') | ||||||
| 		// cy.get('.navbar-nav .avatar').should('be.visible'); | 			.first() | ||||||
|  | 			.should('have.text', 'Nginx Proxy Manager'); | ||||||
|  |  | ||||||
| 		// logout: | 		// logout: | ||||||
| 		cy.clearLocalStorage(); | 		cy.clearLocalStorage(); | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
| 	"name": "test", | 	"name": "npmtestsuite", | ||||||
| 	"version": "1.0.0", | 	"version": "1.0.0", | ||||||
| 	"description": "", | 	"description": "", | ||||||
| 	"main": "index.js", | 	"main": "index.js", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user