Skip to content

Commit

Permalink
remove null constraint on username
Browse files Browse the repository at this point in the history
  • Loading branch information
npalaska committed Feb 28, 2023
1 parent 6c49612 commit d57075a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/pbench/server/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def verify_auth_oidc(auth_token: str) -> Optional[User]:
else:
# Extract what we want to cache from the access token
user_id = token_payload["sub"]
username = token_payload.get("preferred_username")
username = token_payload.get("preferred_username", user_id)
audiences = token_payload.get("resource_access", {})
pb_aud = audiences.get(oidc_client.client_id, {})
roles = pb_aud.get("roles", [])
Expand Down
2 changes: 1 addition & 1 deletion lib/pbench/server/database/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class User(Database.Base):
__tablename__ = "users"

id = Column(String(255), primary_key=True)
username = Column(String(255), unique=True, nullable=True)
username = Column(String(255), unique=True, nullable=False)
dataset_metadata = relationship(
"Metadata", back_populates="user", cascade="all, delete-orphan"
)
Expand Down

0 comments on commit d57075a

Please sign in to comment.