role

Spring Boot Role Based Authentication

守給你的承諾、 提交于 2019-12-06 05:31:38
I have a problem concerning Spring Boot role based authentication. Basically, I would like to have users and admins and I want to prevent users from accessing admin resources. So I created a SecurityConfig class: package test; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org

UserManager.AddToRole not working - Foreign Key error

爱⌒轻易说出口 提交于 2019-12-06 04:15:52
In my ASP.NET MVC application I have some code which should be fairly trivial: UserManager.AddToRole(user.id, "Admin"); I just get this error... The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserRoles_dbo.AspNetRoles_RoleId". The conflict occurred in database "TestDatabase", table "dbo.AspNetRoles", column 'Id'. My ASP.NET Identity Framework is custom in that everything uses Guid as keys instead of int or string . Any ideas what is causing this? Edits, as per user comments... User class public class User : IdentityUser<Guid, UserLogin, UserRole, UserClaim> {

ASP.NET custom role management

徘徊边缘 提交于 2019-12-05 21:43:12
There is Role Management feature in ASP.NET It works on local development machine. For our project we need customers admin to be able to create new users and manage their roles. So, basically same what aspnet_regsql.exe does. Question is Should we develop our own pages and forms or use some ready made tool? Thanks! Sounds like you need the SqlRoleProvider . You can also plug in your own custom Role Provider (and Membership Provider). See How to: Sample Role-Provider Implementation I faced the same problem and solved it by integrating the SecurityGuard NuGet package. It has pretty nice user

how to check the user role inside form builder in Symfony2?

妖精的绣舞 提交于 2019-12-05 01:17:00
Okay, i'm trying to check if an user has a specific role, i did this however, when i do this: public function buildForm(FormBuilder $builder, array $options) { $builder ->add('nombre',null,array('label' => 'Usuario')) ->add('email') ->add('password', 'repeated', array( 'type' => 'password', 'invalid_message' => 'Los campos deben coincidir', 'first_name' => 'password', 'second_name' => 'confirmar password', 'options' => array('required' => false) )) ->add('cliente', 'entity', array( 'class' => 'ClientesBundle:Cliente', 'empty_value' => 'Company', 'required' => false, 'empty_data' => null) **)**

unable to create user postgres: role “postgres” does not exists

狂风中的少年 提交于 2019-12-03 11:36:52
i am on ubuntu 12.04 server and i am trying to install postgresql. As of now, i have successfully installed it but unable to configure it. I need to create a role to move ahead and i ran this command in terminal : root@hostname: createuser -s -r postgres and it said : createuser: could not connect to database postgres: FATAL: role "root" does not exist Fine, so i did : su - postgres and then tried again postgres@hostname: createuser -s -r postgres and i got the error createuser: could not connect to database postgres: FATAL: role "postgres" does not exist and i get the same error when i do

Azure websites complaining Role environment . FAILED TO INITIALIZE on startup

匿名 (未验证) 提交于 2019-12-03 10:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: my question is similar to Azure websites complaining Role environment . FAILED TO INITIALIZE Error that I see in the Azure App Service Support Event Viewer: " 9236 w3wp Role environment . FAILED TO INITIALIZE. hr: -2147024891 " It happens every single time on startup of the website. Other than that - website functions just fine. Except, randomly (it might take 10-30 minutes) it stops with "The application was terminated." (i see this error through azure application logs). I am not sure if these two things are related, but I am trying to

(playframework 2.0.2-java) EBean - No ScalarType registered error when querying with enum values

匿名 (未验证) 提交于 2019-12-03 09:19:38
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have Role entity class: @Entity public class Role extends Model { @Id @Constraints.Required public Integer id; @Constraints.Required @Formats.NonEmpty @Enumerated(EnumType.STRING) public RoleNameEnum name; // name is enum value } In some test I try to find users by role: List<User> users = User.findByRole(Role.findByRoleName(RoleNameEnum.ADMIN)); where method findByRoleName() is following: public static List<User> findByRole(Role role) { return find.where().eq("role", role).findList(); } I receive error: [error] Test UserTest

AddToRole() returns “User name can only contain letters or digits” only when users email address contains a dash

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Asp.Net Identity 2.0, configured so that the users' email address is also the username, so in IdentityConfig I have set AllowOnlyAlphanumericUserNames = false in the ApplicationUserManager constructor: public class ApplicationUserManager : UserManager<ApplicationUser> { public ApplicationUserManager(IUserStore<ApplicationUser> store) : base(store) { } public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context) { var manager = new ApplicationUserManager(new UserStore

I can&#039;t access Tomcat 7 manager when Tomcat is running through IntelliJ Idea Ultimate 12

匿名 (未验证) 提交于 2019-12-03 08:52:47
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to access tomcat manager by using http://localhost:8080/manager but I am always denied the entrance after I enter the password. I get the following message : 403 Access Denied You are not authorized to view this page. If you have already configured the Manager application to allow access and you have used your browsers back button, used a saved book-mark or similar then you may have triggered the cross-site request forgery (CSRF) protection that has been enabled for the HTML interface of the Manager application. You will need to